pinokiod 3.298.0 → 3.301.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.298.0",
3
+ "version": "3.301.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -119,7 +119,7 @@ function wait_ready () {
119
119
  })
120
120
  }
121
121
 
122
- function ensureDevReady(existingLoader = null, label = 'initial') {
122
+ function ensureDevReady(existingLoader = null, label = 'initial', maxWaitMs = 15000) {
123
123
  let loader = existingLoader;
124
124
  const ensureLoader = () => {
125
125
  if (!loader) {
@@ -129,6 +129,7 @@ function ensureDevReady(existingLoader = null, label = 'initial') {
129
129
  };
130
130
 
131
131
  return new Promise((resolve) => {
132
+ const started = Date.now();
132
133
  const attempt = (contextLabel) => {
133
134
  check_dev().then((data) => {
134
135
  if (data && data.transientError) {
@@ -139,7 +140,18 @@ function ensureDevReady(existingLoader = null, label = 'initial') {
139
140
  }
140
141
  const available = !(data && data.available === false)
141
142
  createLauncherDebugLog('wait_ready dev bundle availability (' + contextLabel + ')', available, data);
142
- resolve({ ready: available, closeModal: loader })
143
+ if (available) {
144
+ resolve({ ready: true, closeModal: loader })
145
+ return;
146
+ }
147
+ ensureLoader();
148
+ const elapsed = Date.now() - started;
149
+ if (elapsed >= maxWaitMs) {
150
+ createLauncherDebugLog('wait_ready dev bundle wait timeout', { elapsed, contextLabel });
151
+ resolve({ ready: false, closeModal: loader })
152
+ return;
153
+ }
154
+ setTimeout(() => attempt('retry'), 500);
143
155
  })
144
156
  };
145
157
  attempt(label)