arcadible 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/serve/page.js +14 -14
- package/src/serve/remote.js +1 -1
- package/src/util/screenshot.js +1 -1
package/package.json
CHANGED
package/src/serve/page.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// the local play page: it frames the game as the play page does
|
|
3
|
-
// (
|
|
3
|
+
// (ui/src/play), with the same
|
|
4
4
|
// sandbox and permissions, and runs the play page's own host for the SDK,
|
|
5
5
|
// so saves are kept by the page, across builds. It reloads the
|
|
6
6
|
// game, and only the game, when told to. Its tab shows the game's store
|
|
@@ -35,8 +35,8 @@ const ICON = "/_arcadible/icon";
|
|
|
35
35
|
// the loading screen's art and icon, PNGs, or 404 without.
|
|
36
36
|
const ART = "/_arcadible/art.png";
|
|
37
37
|
const ICON_PNG = "/_arcadible/icon.png";
|
|
38
|
-
// the loading screen's timing, as the play page's (
|
|
39
|
-
// least the minimum, then a fade; a game that
|
|
38
|
+
// the loading screen's timing, as the play page's (ui/src/play/loading.ts): up at
|
|
39
|
+
// least the minimum, then a fade; a game that started and stops reporting
|
|
40
40
|
// comes down after `STUCK` without a call; the SDK's word at load is
|
|
41
41
|
// waited for `SAFETY` at most.
|
|
42
42
|
const LOADING = { FADE: 300, MINIMUM: 1500, SAFETY: 2000, STUCK: 30000 };
|
|
@@ -91,8 +91,8 @@ const escapeHtml = function (text) {
|
|
|
91
91
|
|
|
92
92
|
// [function]
|
|
93
93
|
|
|
94
|
-
// the loading screen, as the play page's (
|
|
95
|
-
//
|
|
94
|
+
// the loading screen, as the play page's (ui/src/play/play.css;
|
|
95
|
+
// ui/ARCHITECTURE.md, The play page's loading screen): without
|
|
96
96
|
// the developer's name, which isn't known here, or the rotate prompt, since
|
|
97
97
|
// arc serve listens on this machine only.
|
|
98
98
|
const LOADING_CSS =
|
|
@@ -139,12 +139,12 @@ const html = function (game) {
|
|
|
139
139
|
const frame = document.createElement("iframe");
|
|
140
140
|
frame.allow = config.allow;
|
|
141
141
|
frame.sandbox = config.sandbox;
|
|
142
|
-
// the loading screen, as the play page runs it (
|
|
142
|
+
// the loading screen, as the play page runs it (ui/src/play/loading.ts): decided
|
|
143
143
|
// once, at the first load, from whether the game's SDK can report and
|
|
144
|
-
//
|
|
144
|
+
// started; down after LOADING.MINIMUM, faded. Reloads after a save don't
|
|
145
145
|
// show it again, so iterating stays instant.
|
|
146
146
|
const cover = document.getElementById("loading");
|
|
147
|
-
const loading = {
|
|
147
|
+
const loading = { started: false, decided: false, down: false, leaving: false, reports: false, safety: 0, stuck: 0, visible: [] };
|
|
148
148
|
const gone = () => {
|
|
149
149
|
if (loading.down) return;
|
|
150
150
|
loading.down = true;
|
|
@@ -186,7 +186,7 @@ const html = function (game) {
|
|
|
186
186
|
frame.addEventListener("load", () => {
|
|
187
187
|
frame.focus();
|
|
188
188
|
if (loading.decided) return;
|
|
189
|
-
if (loading.reports) loading.safety = setTimeout(() => decide(loading.
|
|
189
|
+
if (loading.reports) loading.safety = setTimeout(() => decide(loading.started), config.loading.SAFETY);
|
|
190
190
|
else decide(false);
|
|
191
191
|
});
|
|
192
192
|
// the host answers the game's hello, so it's created before the frame
|
|
@@ -200,10 +200,10 @@ const html = function (game) {
|
|
|
200
200
|
frame,
|
|
201
201
|
game: config.game,
|
|
202
202
|
lifecycle: {
|
|
203
|
-
|
|
204
|
-
loading.
|
|
203
|
+
start: () => {
|
|
204
|
+
loading.started = true;
|
|
205
205
|
},
|
|
206
|
-
|
|
206
|
+
complete: () => new Promise((resolve) => {
|
|
207
207
|
if (loading.down) {
|
|
208
208
|
resolve();
|
|
209
209
|
return;
|
|
@@ -211,9 +211,9 @@ const html = function (game) {
|
|
|
211
211
|
loading.visible.push(resolve);
|
|
212
212
|
takeDown();
|
|
213
213
|
}),
|
|
214
|
-
loaded: (
|
|
214
|
+
loaded: (started) => {
|
|
215
215
|
clearTimeout(loading.safety);
|
|
216
|
-
decide(
|
|
216
|
+
decide(started);
|
|
217
217
|
},
|
|
218
218
|
progress: (fraction) => {
|
|
219
219
|
if (loading.down || loading.leaving) return;
|
package/src/serve/remote.js
CHANGED
|
@@ -20,7 +20,7 @@ const writeFile = fs.promises.writeFile;
|
|
|
20
20
|
// [declare]
|
|
21
21
|
|
|
22
22
|
// the play page's host, as the play page runs it, published with each web
|
|
23
|
-
// deploy on the play site (
|
|
23
|
+
// deploy on the play site (ui's play build). Any number in /static/<n>/ is
|
|
24
24
|
// served, and each is cached at Google's edge for a year, so a new one gets
|
|
25
25
|
// the current copy. `v1` is the shape of the `arcadibleHost` global, which
|
|
26
26
|
// this CLI calls: a breaking change to it is v2, beside v1.
|
package/src/util/screenshot.js
CHANGED
|
@@ -10,7 +10,7 @@ const posixBasename = path.posix.basename;
|
|
|
10
10
|
|
|
11
11
|
// [declare]
|
|
12
12
|
|
|
13
|
-
// a screenshot's name, as the store reads it (
|
|
13
|
+
// a screenshot's name, as the store reads it (ui's `screenshots()`): its
|
|
14
14
|
// number, and its qualifier, the platform it's for, if any.
|
|
15
15
|
const SCREENSHOT = /^screenshot_(\d+)(?:_([^.]+))?\.[^.]+$/u;
|
|
16
16
|
|