estreui 1.2.2 → 1.2.4
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/README.md +10 -0
- package/index.html +8 -1
- package/package.json +9 -5
- package/scripts/alienese.js +282 -275
- package/scripts/boot.js +107 -67
- package/scripts/doctre.js +330 -6
- package/scripts/estreU0EEOZ.js +64 -6
- package/scripts/estreUi-core.js +555 -0
- package/scripts/estreUi-dialog.js +511 -0
- package/scripts/estreUi-handles.js +7243 -0
- package/scripts/estreUi-interaction.js +1374 -0
- package/scripts/estreUi-main.js +1667 -0
- package/scripts/estreUi-notation.js +596 -0
- package/scripts/estreUi-pageManager.js +625 -0
- package/scripts/estreUi-pageModel.js +4317 -0
- package/scripts/modernism.js +44 -3
- package/serviceWorker.js +10 -3
- package/scripts/estreUi.js +0 -16294
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
/*
|
|
2
|
+
EstreUI rimwork — Dialog API: popup, toast, alert, confirm, prompt
|
|
3
|
+
Part of the split from estreUi.js (roadmap #002 phase 2).
|
|
4
|
+
|
|
5
|
+
This file is loaded as a plain <script> tag and shares the global scope
|
|
6
|
+
with the other estreUi-*.js files. Load order matters: see index.html.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// MODULE: Dialog API -- popup browser, toast, alert, confirm, prompt,
|
|
10
|
+
// wait/stedy/go, notification helpers
|
|
11
|
+
// ======================================================================
|
|
12
|
+
|
|
13
|
+
// Popup browser
|
|
14
|
+
function estrePopupBrowser(options = {}, instanceOrigin) {
|
|
15
|
+
return new Promise((resolve) => pageManager.bringPage("!popupBrowser", {
|
|
16
|
+
data: options,
|
|
17
|
+
onBeforeAttach(handle, iframe) {
|
|
18
|
+
this?.data?.callbackBeforeAttach?.(handle, iframe);
|
|
19
|
+
},
|
|
20
|
+
onAfterAttach(handle, iframe, url) {
|
|
21
|
+
this?.data?.callbackAfterAttach?.(handle, iframe, url);
|
|
22
|
+
},
|
|
23
|
+
onLoad(handle, iframe, url) {
|
|
24
|
+
this?.data?.callbackLoad?.(handle, iframe, url);
|
|
25
|
+
},
|
|
26
|
+
onClosePopup(handle, iframe, url) {
|
|
27
|
+
this?.data?.callbackClose?.(handle, iframe, url);
|
|
28
|
+
resolve();
|
|
29
|
+
},
|
|
30
|
+
onClickRefresh(handle, iframe, url) {
|
|
31
|
+
return this?.data?.callbackRefresh?.(handle, iframe, url);
|
|
32
|
+
},
|
|
33
|
+
onClickBack(handle, iframe, url) {
|
|
34
|
+
return this?.data?.callbackBack?.(handle, iframe, url);
|
|
35
|
+
},
|
|
36
|
+
onClickForward(handle, iframe, url) {
|
|
37
|
+
return this?.data?.callbackForward?.(handle, iframe, url);
|
|
38
|
+
},
|
|
39
|
+
}, instanceOrigin));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const popupBrowser = (src = "about:blank", name = "webview",
|
|
43
|
+
callbackBeforeAttach = (handle, iframe) => {},
|
|
44
|
+
callbackAfterAttach = (handle, iframe) => {},
|
|
45
|
+
callbackClose = (handle, iframe, url) => {},
|
|
46
|
+
fixedTitle = null,
|
|
47
|
+
callbackLoad = (handle, iframe, url) => {},
|
|
48
|
+
hideRefresh = false,
|
|
49
|
+
callbackRefresh = (handle, iframe, url) => false,
|
|
50
|
+
hideBack = false,
|
|
51
|
+
callbackBack = (handle, iframe, url) => false,
|
|
52
|
+
hideForward = false,
|
|
53
|
+
callbackForward = (handle, iframe, url) => false,
|
|
54
|
+
hideHome = false,
|
|
55
|
+
) => estrePopupBrowser({ src, name, callbackBeforeAttach, callbackAfterAttach, callbackClose, fixedTitle, callbackLoad, hideRefresh, callbackRefresh, hideBack, callbackBack, hideForward, callbackForward, hideHome });
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const closePopupBrowserWhenOnTop = async () => {
|
|
59
|
+
const container = estreUi.showingOverlayTopArticle?.container;
|
|
60
|
+
if (container?.handler.id == "popupBrowser") return await container.close();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// Toast up slide dialog
|
|
65
|
+
function estreToastAlert(options = {}, instanceOrigin) {
|
|
66
|
+
return new Promise((resolve) => pageManager.bringPage("!toastAlert", {
|
|
67
|
+
data: options,
|
|
68
|
+
onOk() {
|
|
69
|
+
this?.data?.callbackOk?.();
|
|
70
|
+
resolve(true);
|
|
71
|
+
},
|
|
72
|
+
onDissmiss() {
|
|
73
|
+
this?.data?.callbackDissmiss?.();
|
|
74
|
+
resolve(undefined);
|
|
75
|
+
},
|
|
76
|
+
}, instanceOrigin));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const toastAlert = (title, message,
|
|
80
|
+
callbackOk = () => {},
|
|
81
|
+
callbackDissmiss = () => {},
|
|
82
|
+
ok = isKorean() ? "확인" : "OK",
|
|
83
|
+
) => estreToastAlert({ title, message, callbackOk, callbackDissmiss, ok });
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
function estreToastConfirm(options = {}, instanceOrigin) {
|
|
87
|
+
return new Promise((resolve) => pageManager.bringPage("!toastConfirm", {
|
|
88
|
+
data: options,
|
|
89
|
+
onPositive() {
|
|
90
|
+
this?.data?.callbackPositive?.();
|
|
91
|
+
resolve(true);
|
|
92
|
+
},
|
|
93
|
+
onNegative() {
|
|
94
|
+
this?.data?.callbackNegative?.();
|
|
95
|
+
resolve(false);
|
|
96
|
+
},
|
|
97
|
+
onNeutral() {
|
|
98
|
+
this?.data?.callbackNeutral?.();
|
|
99
|
+
resolve(null);
|
|
100
|
+
},
|
|
101
|
+
onDissmiss() {
|
|
102
|
+
this?.data?.callbackDissmiss?.();
|
|
103
|
+
resolve(undefined);
|
|
104
|
+
},
|
|
105
|
+
}, instanceOrigin));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const toastConfirm = (title, message,
|
|
109
|
+
callbackPositive = () => {},
|
|
110
|
+
callbackNegative = () => {},
|
|
111
|
+
callbackDissmiss = () => {},
|
|
112
|
+
callbackNeutral = null,
|
|
113
|
+
positive = isKorean() ? "예" : "OK",
|
|
114
|
+
negative = isKorean() ? "아니오" : "NO",
|
|
115
|
+
neutral = isKorean() ? "나중에" : "Later",
|
|
116
|
+
) => estreToastConfirm({ title, message, callbackPositive, callbackNegative, callbackDissmiss, callbackNeutral, positive, negative, neutral });
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
function estreToastPrompt(options = {}) {
|
|
120
|
+
return new Promise((resolve) => pageManager.bringPage("!toastPrompt", {
|
|
121
|
+
data: options,
|
|
122
|
+
onPromptFocus(input, text, event) {
|
|
123
|
+
this?.data?.callbackFocus?.(input, text, event);
|
|
124
|
+
},
|
|
125
|
+
onPromptInput(input, text, event) {
|
|
126
|
+
this?.data?.callbackInput?.(input, text, event);
|
|
127
|
+
},
|
|
128
|
+
onPromptPaste(input, pasteText, text, event) {
|
|
129
|
+
this?.data?.callbackPaste?.(input, pasteText, text, event);
|
|
130
|
+
},
|
|
131
|
+
onPromptChange(input, text, event) {
|
|
132
|
+
this?.data?.callbackChange?.(input, text, event);
|
|
133
|
+
},
|
|
134
|
+
onPromptBlur(input, text, event) {
|
|
135
|
+
this?.data?.callbackBlur?.(input, text, event);
|
|
136
|
+
},
|
|
137
|
+
onConfirm(text) {
|
|
138
|
+
this?.data?.callbackConfirm?.(text);
|
|
139
|
+
resolve(text);
|
|
140
|
+
},
|
|
141
|
+
onDissmiss() {
|
|
142
|
+
this?.data?.callbackDissmiss?.();
|
|
143
|
+
resolve(undefined);
|
|
144
|
+
},
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const toastPrompt = (title,
|
|
149
|
+
value = "",
|
|
150
|
+
message,
|
|
151
|
+
callbackConfirm = (text) => {},
|
|
152
|
+
callbackDissmiss = () => {},
|
|
153
|
+
confirm = isKorean() ? "확인" : "Confirm",
|
|
154
|
+
placeholder = "",
|
|
155
|
+
type = "text",//number, password
|
|
156
|
+
) => estreToastPrompt({ title, message, callbackConfirm, callbackDissmiss, confirm, placeholder, type, value });
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
function estreToastOption(options = {}, instanceOrigin) {
|
|
160
|
+
return new Promise((resolve) => pageManager.bringPage("!toastOption", {
|
|
161
|
+
data: options,
|
|
162
|
+
onSelected(key, value) {
|
|
163
|
+
this?.data?.callbackSelected?.(key, value);
|
|
164
|
+
resolve(key);
|
|
165
|
+
},
|
|
166
|
+
onDissmiss() {
|
|
167
|
+
this?.data?.callbackDissmiss?.();
|
|
168
|
+
resolve(undefined);
|
|
169
|
+
},
|
|
170
|
+
}, instanceOrigin));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const toastOption = (title = "", message = "",
|
|
174
|
+
options = ["option A", "option B", "option C"],
|
|
175
|
+
callbackSelected = (key, value) => {},
|
|
176
|
+
callbackDissmiss = () => {},
|
|
177
|
+
) => estreToastOption({ title, message, options, callbackSelected, callbackDissmiss });
|
|
178
|
+
|
|
179
|
+
const optionToast = (options = ["option A", "option B", "option C"],
|
|
180
|
+
callbackSelected = (key, value) => {},
|
|
181
|
+
callbackDissmiss = () => {},
|
|
182
|
+
title = "", message = "",
|
|
183
|
+
) => toastOption(title, message, options, callbackSelected, callbackDissmiss);
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
function estreToastSelection(options = {}) {
|
|
187
|
+
return new Promise((resolve) => pageManager.bringPage("!toastSelection", {
|
|
188
|
+
data: options,
|
|
189
|
+
onConfirm(selections, keys, values) {
|
|
190
|
+
this.data?.callbackConfirm?.(selections, keys, values);
|
|
191
|
+
resolve(selections)
|
|
192
|
+
},
|
|
193
|
+
onSelect(selected, key, value, selections, keys, values) {
|
|
194
|
+
this?.data?.callbackSelect?.(selected, key, value, selections, keys, values);
|
|
195
|
+
},
|
|
196
|
+
onAnother(selections, keys, values) {
|
|
197
|
+
this?.data?.callbackAnother?.(selections, keys, values);
|
|
198
|
+
resolve(false);
|
|
199
|
+
},
|
|
200
|
+
onDissmiss(selections, keys, values) {
|
|
201
|
+
this?.data?.callbackDissmiss?.(selections, keys, values);
|
|
202
|
+
resolve(undefined);
|
|
203
|
+
},
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const toastSelection = (title = "", message = "",
|
|
208
|
+
minSelection = 1,
|
|
209
|
+
maxSelection = -1,
|
|
210
|
+
options = ["option A", "option B", "option C"],
|
|
211
|
+
defaultSelected = [],
|
|
212
|
+
callbackConfirm = (selections, keys, values) => {},
|
|
213
|
+
callbackSelect = (selected, key, value, selections, keys, values) => {},
|
|
214
|
+
callbackDissmiss = (selections, keys, values) => {},
|
|
215
|
+
callbackAnother = null,
|
|
216
|
+
confirm = isKorean() ? "확인" : "Confirm",
|
|
217
|
+
another = isKorean() ? "나중에" : "later",
|
|
218
|
+
) => estreToastSelection({ title, message, options, minSelection, maxSelection, defaultSelected, callbackConfirm, callbackSelect, callbackDissmiss, callbackAnother, confirm, another });
|
|
219
|
+
|
|
220
|
+
const selectionToast = (options = ["option A", "option B", "option C"],
|
|
221
|
+
minSelection = 1,
|
|
222
|
+
maxSelection = -1,
|
|
223
|
+
defaultSelected = [],
|
|
224
|
+
title = "", message = "",
|
|
225
|
+
callbackConfirm = (selections, keys, values) => {},
|
|
226
|
+
confirm = isKorean() ? "확인" : "Confirm",
|
|
227
|
+
callbackAnother = null,
|
|
228
|
+
another = isKorean() ? "나중에" : "later",
|
|
229
|
+
callbackDissmiss = (selections, keys, values) => {},
|
|
230
|
+
callbackSelect = (selected, key, value, selections, keys, values) => {},
|
|
231
|
+
) => toastSelection(title, message, minSelection, maxSelection, options, defaultSelected, callbackConfirm, callbackSelect, callbackDissmiss, callbackAnother, confirm, another);
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
function estreToastDials(options = {}, instanceOrigin) {
|
|
235
|
+
const arrays = [c.table, c.initial, c.aligns, c.prefixes, c.suffixes, c.dividers];
|
|
236
|
+
for (const name of arrays) if (!typeString(options[name])) options[name] = Jcodd.coddify(options[name]);
|
|
237
|
+
options.stretch = !options.stretch ? "" : t1;
|
|
238
|
+
options.hideScrollbar = !options.hideScrollbar ? "" : t1;
|
|
239
|
+
let intent;
|
|
240
|
+
new Promise((resolve) => {
|
|
241
|
+
intent = {
|
|
242
|
+
data: options,
|
|
243
|
+
onConfirm(selections, keys, values) {
|
|
244
|
+
this.data?.callbackConfirm?.(selections, keys, values);
|
|
245
|
+
resolve(selections)
|
|
246
|
+
},
|
|
247
|
+
onSelect(boundIndex, index, value, selectionIndexes, selectionValues) {
|
|
248
|
+
this?.data?.callbackSelect?.(boundIndex, index, value, selectionIndexes, selectionValues);
|
|
249
|
+
},
|
|
250
|
+
onAnother(selections, keys, values) {
|
|
251
|
+
this?.data?.callbackAnother?.(selections, keys, values);
|
|
252
|
+
resolve(false);
|
|
253
|
+
},
|
|
254
|
+
onDissmiss(selections, keys, values) {
|
|
255
|
+
this?.data?.callbackDissmiss?.(selections, keys, values);
|
|
256
|
+
resolve(undefined);
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
return pageManager.bringPage("!toastDials", intent, instanceOrigin);
|
|
260
|
+
});
|
|
261
|
+
return new class {
|
|
262
|
+
get data() { return intent.data; }
|
|
263
|
+
get handle() { return intent.handle; }
|
|
264
|
+
}();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const toastDials = (title = "", message = "",
|
|
268
|
+
table = [[]],
|
|
269
|
+
initial = [],
|
|
270
|
+
callbackConfirm = (selections, keys, values) => {},
|
|
271
|
+
callbackSelect = (boundIndex, index, value, selectionIndexes, selectionValues) => {},
|
|
272
|
+
callbackDissmiss = (selections, keys, values) => {},
|
|
273
|
+
callbackAnother = null,
|
|
274
|
+
confirm = isKorean() ? "닫기" : "Close",
|
|
275
|
+
another = isKorean() ? "되돌리기" : "rollback",
|
|
276
|
+
aligns = [],
|
|
277
|
+
prefixes = [],
|
|
278
|
+
suffixes = [],
|
|
279
|
+
dividers = [],
|
|
280
|
+
stretch = t,
|
|
281
|
+
hideScrollbar = t,
|
|
282
|
+
) => estreToastDials({ title, message, table, initial, aligns, prefixes, suffixes, dividers, stretch, hideScrollbar, callbackConfirm, callbackSelect, callbackDissmiss, callbackAnother, confirm, another });
|
|
283
|
+
|
|
284
|
+
const dialsToast = (table = [[]],
|
|
285
|
+
initial = [],
|
|
286
|
+
title = "", message = "",
|
|
287
|
+
callbackConfirm = (selections, keys, values) => {},
|
|
288
|
+
confirm = isKorean() ? "닫기" : "Close",
|
|
289
|
+
callbackAnother = null,
|
|
290
|
+
another = isKorean() ? "되돌리기" : "rollback",
|
|
291
|
+
callbackDissmiss = (selections, keys, values) => {},
|
|
292
|
+
callbackSelect = (boundIndex, index, value, selectionIndexes, selectionValues) => {},
|
|
293
|
+
aligns = [],
|
|
294
|
+
prefixes = [],
|
|
295
|
+
suffixes = [],
|
|
296
|
+
dividers = [],
|
|
297
|
+
stretch = t,
|
|
298
|
+
hideScrollbar = t,
|
|
299
|
+
) => toastDials(title, message, table, initial, callbackConfirm, callbackSelect, callbackDissmiss, callbackAnother, confirm, another, aligns, prefixes, suffixes, dividers, stretch, hideScrollbar);
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
//override global(window) methods
|
|
305
|
+
classicAlert = alert;
|
|
306
|
+
classicConfirm = confirm;
|
|
307
|
+
classicPrompt = prompt;
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
function estreAlert(options = {}, instanceOrigin) {
|
|
311
|
+
return new Promise((resolve) => pageManager.bringPage("!alert", {
|
|
312
|
+
data: options,
|
|
313
|
+
onOk() {
|
|
314
|
+
this?.data?.callbackOk?.();
|
|
315
|
+
resolve(true);
|
|
316
|
+
},
|
|
317
|
+
onDissmiss() {
|
|
318
|
+
this?.data?.callbackDissmiss?.();
|
|
319
|
+
resolve(undefined);
|
|
320
|
+
},
|
|
321
|
+
}, instanceOrigin));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
alert = (title, message,
|
|
325
|
+
callbackOk = () => {},
|
|
326
|
+
callbackDissmiss = () => {},
|
|
327
|
+
ok = isKorean() ? "확인" : "OK",
|
|
328
|
+
) => tu(title) ? classicAlert() : estreAlert({ title, message, callbackOk, callbackDissmiss, ok });
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
function estreConfirm(options = {}, instanceOrigin) {
|
|
332
|
+
return new Promise((resolve) => pageManager.bringPage("!confirm", {
|
|
333
|
+
data: options,
|
|
334
|
+
onPositive() {
|
|
335
|
+
this?.data?.callbackPositive?.();
|
|
336
|
+
resolve(true);
|
|
337
|
+
},
|
|
338
|
+
onNegative() {
|
|
339
|
+
this?.data?.callbackNegative?.();
|
|
340
|
+
resolve(false);
|
|
341
|
+
},
|
|
342
|
+
onNeutral() {
|
|
343
|
+
this?.data?.callbackNeutral?.();
|
|
344
|
+
resolve(null);
|
|
345
|
+
},
|
|
346
|
+
onDissmiss() {
|
|
347
|
+
this?.data?.callbackDissmiss?.();
|
|
348
|
+
resolve(undefined);
|
|
349
|
+
},
|
|
350
|
+
}, instanceOrigin));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
confirm = (title, message,
|
|
354
|
+
callbackPositive = () => {},
|
|
355
|
+
callbackNegative = () => {},
|
|
356
|
+
callbackDissmiss = () => {},
|
|
357
|
+
callbackNeutral = null,
|
|
358
|
+
positive = isKorean() ? "예" : "OK",
|
|
359
|
+
negative = isKorean() ? "아니오" : "NO",
|
|
360
|
+
neutral = isKorean() ? "나중에" : "Later",
|
|
361
|
+
) => {
|
|
362
|
+
if (typeof message == UNDEFINED) return classicConfirm(title + (message != null ? "\n" + message : ""));
|
|
363
|
+
else return estreConfirm({ title, message, callbackPositive, callbackNegative, callbackDissmiss, callbackNeutral, positive, negative, neutral });
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
function estrePrompt(options = {}, instanceOrigin) {
|
|
368
|
+
return new Promise((resolve) => pageManager.bringPage("!prompt", {
|
|
369
|
+
data: options,
|
|
370
|
+
onPromptFocus(input, text, event) {
|
|
371
|
+
this?.data?.callbackFocus?.(input, text, event);
|
|
372
|
+
},
|
|
373
|
+
onPromptInput(input, text, event) {
|
|
374
|
+
this?.data?.callbackInput?.(input, text, event);
|
|
375
|
+
},
|
|
376
|
+
onPromptPaste(input, pasteText, text, event) {
|
|
377
|
+
this?.data?.callbackPaste?.(input, pasteText, text, event);
|
|
378
|
+
},
|
|
379
|
+
onPromptChange(input, text, event) {
|
|
380
|
+
this?.data?.callbackChange?.(input, text, event);
|
|
381
|
+
},
|
|
382
|
+
onPromptBlur(input, text, event) {
|
|
383
|
+
this?.data?.callbackBlur?.(input, text, event);
|
|
384
|
+
},
|
|
385
|
+
onConfirm(text) {
|
|
386
|
+
this?.data?.callbackConfirm?.(text);
|
|
387
|
+
resolve(text);
|
|
388
|
+
},
|
|
389
|
+
onDissmiss() {
|
|
390
|
+
this?.data?.callbackDissmiss?.();
|
|
391
|
+
resolve(undefined);
|
|
392
|
+
},
|
|
393
|
+
}, instanceOrigin));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
prompt = (title,
|
|
397
|
+
value = "",
|
|
398
|
+
message,
|
|
399
|
+
callbackConfirm = (text) => {},
|
|
400
|
+
callbackDissmiss = () => {},
|
|
401
|
+
confirm = isKorean() ? "확인" : "Confirm",
|
|
402
|
+
placeholder = "",
|
|
403
|
+
type = "text",//number, password
|
|
404
|
+
) => {
|
|
405
|
+
if (typeof message == UNDEFINED) return classicPrompt(title + (message != null ? "\n" + message : ""));
|
|
406
|
+
else return estrePrompt({ title, message, callbackConfirm, callbackDissmiss, confirm, placeholder, type, value });
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
// Infinite loop and prograss meter
|
|
411
|
+
const waitings = new Set();
|
|
412
|
+
// let latestIO = null;
|
|
413
|
+
let backHolds = 0;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Show infinite loop wait indicator
|
|
417
|
+
*
|
|
418
|
+
* @param {instanceOrigin: string} / instance access origin code
|
|
419
|
+
*/
|
|
420
|
+
const wait = function (options, instanceOrigin = "wait_" + Date.now()) {
|
|
421
|
+
// if (instanceOrigin != n) waitings.add(instanceOrigin);
|
|
422
|
+
// latestIO = instanceOrigin;
|
|
423
|
+
pageManager.bringPage("!onRunning", { data: options }, instanceOrigin);
|
|
424
|
+
return instanceOrigin;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Show infinite loop wait indicator before stedy specified delay time for go()
|
|
429
|
+
*
|
|
430
|
+
* @param {delay: Number} / wait go() before bring wait indicator (ms, default is 600)
|
|
431
|
+
* @param {instanceOrigin: string} / instance access origin code (default is to be auto generated)
|
|
432
|
+
*/
|
|
433
|
+
const stedy = function (options, delay = 600, instanceOrigin = "stedy_" + Date.now()) {
|
|
434
|
+
if (instanceOrigin != n) waitings.add(instanceOrigin);
|
|
435
|
+
// latestIO = instanceOrigin;
|
|
436
|
+
setTimeout(_ => {
|
|
437
|
+
if (waitings.has(instanceOrigin)) {
|
|
438
|
+
waitings.delete(instanceOrigin);
|
|
439
|
+
wait(options, instanceOrigin);
|
|
440
|
+
}
|
|
441
|
+
}, delay);
|
|
442
|
+
return instanceOrigin;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const onBackWhile = function (handle) {
|
|
446
|
+
if (handle != n) {// || latestIO != n) {
|
|
447
|
+
backHolds++;
|
|
448
|
+
return t;
|
|
449
|
+
}
|
|
450
|
+
return f;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Hide infinite loop wait indicator
|
|
455
|
+
*
|
|
456
|
+
* @param {instanceOrigin} / instance access origin code
|
|
457
|
+
*/
|
|
458
|
+
const go = function (instanceOrigin) {
|
|
459
|
+
// if (instanceOrigin != n) {
|
|
460
|
+
// if (waitings.has(instanceOrigin) == f) return;
|
|
461
|
+
// waitings.delete(instanceOrigin);
|
|
462
|
+
// if (latestIO != instanceOrigin && waitings.size > 0) return;
|
|
463
|
+
// }
|
|
464
|
+
if (instanceOrigin != n && waitings.has(instanceOrigin)) {
|
|
465
|
+
waitings.delete(instanceOrigin);
|
|
466
|
+
// return instanceOrigin;
|
|
467
|
+
}
|
|
468
|
+
const aio = pageManager.closePage("!onRunning", f, instanceOrigin);
|
|
469
|
+
// latestIO = n;
|
|
470
|
+
if (backHolds > 0) postAsyncQueue(async _ => {
|
|
471
|
+
const holds = backHolds;
|
|
472
|
+
backHolds = 0;
|
|
473
|
+
await aio;
|
|
474
|
+
if (window.isLogging) console.log("Release holded back requests");
|
|
475
|
+
for (let i=0; i<holds; i++) await estreUi.onBack();
|
|
476
|
+
// await estreUi.onBack();
|
|
477
|
+
})
|
|
478
|
+
return aio;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Show progress bar(or own custom shape)
|
|
484
|
+
*
|
|
485
|
+
* @param {meter: object} { current: is 0 to 1000, null to finish } is binded to UI
|
|
486
|
+
* @param {instanceOrigin: string} / instance access origin code
|
|
487
|
+
*
|
|
488
|
+
* @returns {bindedHandle: object} Adjust bindedHandle.current value to progress animation
|
|
489
|
+
*/
|
|
490
|
+
const going = function (meter = { current: 0 }, instanceOrigin) {
|
|
491
|
+
meter.instanceOrigin = instanceOrigin;
|
|
492
|
+
return pageManager.bringPage("!onProgress", { data: meter }, instanceOrigin) ? meter.binded : undefined;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Hide progress bar(or own custom shape)
|
|
497
|
+
*
|
|
498
|
+
* @param {instanceOrigin: string} / instance access origin code
|
|
499
|
+
*/
|
|
500
|
+
const arrived = function (instanceOrigin) {
|
|
501
|
+
return pageManager.closePage("!onProgress", false, instanceOrigin);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
const noti = function (title, htmlContent, onTakeInteraction = (intent) => {}, mainIconSrc, subIconSrc) {
|
|
507
|
+
//<= To do implement
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
// ======================================================================
|