clickgo 3.1.2-dev11 → 3.1.4-dev13

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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +0 -73
  3. package/dist/app/demo/config.json +113 -0
  4. package/dist/app/demo/form/control/button/button.js +12 -11
  5. package/dist/app/demo/form/control/button/button.xml +6 -6
  6. package/dist/app/demo/form/control/check/check.js +14 -10
  7. package/dist/app/demo/form/control/file/file.js +15 -13
  8. package/dist/app/demo/form/control/{overflow/overflow.css → flow/flow.css} +0 -0
  9. package/dist/app/demo/form/control/flow/flow.js +64 -0
  10. package/dist/app/demo/form/control/{overflow/overflow.scss → flow/flow.scss} +0 -0
  11. package/dist/app/demo/form/control/flow/flow.xml +101 -0
  12. package/dist/app/demo/form/control/form/form.js +1 -1
  13. package/dist/app/demo/form/control/form/form.xml +3 -3
  14. package/dist/app/demo/form/control/img/img.xml +2 -2
  15. package/dist/app/demo/form/control/list/list.js +95 -75
  16. package/dist/app/demo/form/control/list/list.xml +15 -11
  17. package/dist/app/demo/form/control/marquee/marquee.js +12 -10
  18. package/dist/app/demo/form/control/menu/menu.js +10 -6
  19. package/dist/app/demo/form/control/monaco/monaco.js +50 -60
  20. package/dist/app/demo/form/control/monaco/monaco.xml +6 -5
  21. package/dist/app/demo/form/control/property/property.js +131 -127
  22. package/dist/app/demo/form/control/radio/radio.js +9 -5
  23. package/dist/app/demo/form/control/scroll/scroll.js +16 -12
  24. package/dist/app/demo/form/control/scroll/scroll.xml +10 -10
  25. package/dist/app/demo/form/control/select/select.js +132 -71
  26. package/dist/app/demo/form/control/select/select.xml +69 -67
  27. package/dist/app/demo/form/control/tab/tab.js +21 -20
  28. package/dist/app/demo/form/control/tab/tab.xml +2 -2
  29. package/dist/app/demo/form/control/text/text.js +53 -45
  30. package/dist/app/demo/form/control/text/text.xml +3 -3
  31. package/dist/app/demo/form/control/{greatview/greatview.css → vflow/vflow.css} +0 -0
  32. package/dist/app/demo/form/control/vflow/vflow.js +79 -0
  33. package/dist/app/demo/form/control/{greatview/greatview.scss → vflow/vflow.scss} +0 -0
  34. package/dist/app/demo/form/control/{greatview/greatview.xml → vflow/vflow.xml} +25 -25
  35. package/dist/app/demo/form/event/form/form.js +58 -56
  36. package/dist/app/demo/form/event/form/form.xml +3 -3
  37. package/dist/app/demo/form/event/other/other.js +29 -0
  38. package/dist/app/demo/form/event/other/other.xml +5 -0
  39. package/dist/app/demo/form/event/screen/screen.js +30 -28
  40. package/dist/app/demo/form/event/screen/screen.xml +2 -2
  41. package/dist/app/demo/form/event/task/task.js +31 -31
  42. package/dist/app/demo/form/event/task/task.xml +3 -3
  43. package/dist/app/demo/form/main.js +166 -5
  44. package/dist/app/demo/form/main.xml +37 -35
  45. package/dist/app/demo/form/method/aform/aform.js +2 -1
  46. package/dist/app/demo/form/method/aform/aform.xml +3 -2
  47. package/dist/app/demo/form/method/aform/sd.js +28 -0
  48. package/dist/app/demo/form/method/aform/sd.xml +7 -0
  49. package/dist/app/demo/form/method/aform/test.xml +4 -5
  50. package/dist/app/demo/form/method/core/core.js +23 -8
  51. package/dist/app/demo/form/method/core/core.xml +6 -1
  52. package/dist/app/demo/form/method/dom/dom.js +91 -99
  53. package/dist/app/demo/form/method/dom/dom.xml +6 -7
  54. package/dist/app/demo/form/method/form/form.js +8 -8
  55. package/dist/app/demo/form/method/form/form.xml +4 -4
  56. package/dist/app/demo/form/method/fs/fs.js +34 -33
  57. package/dist/app/demo/form/method/fs/fs.xml +1 -1
  58. package/dist/app/demo/form/method/fs/text.js +12 -12
  59. package/dist/app/demo/form/method/native/native.js +50 -0
  60. package/dist/app/demo/form/method/native/native.xml +12 -0
  61. package/dist/app/demo/form/method/system/system.js +50 -0
  62. package/dist/app/demo/form/method/system/system.xml +11 -0
  63. package/dist/app/demo/form/method/task/task.js +68 -62
  64. package/dist/app/demo/form/method/task/task.xml +5 -6
  65. package/dist/app/demo/form/method/theme/theme.js +14 -14
  66. package/dist/app/demo/form/method/tool/tool.js +29 -28
  67. package/dist/app/demo/form/method/tool/tool.xml +3 -3
  68. package/dist/app/demo/form/method/zip/zip.js +46 -41
  69. package/dist/app/demo/form/method/zip/zip.xml +1 -1
  70. package/dist/app/task/app.js +0 -25
  71. package/dist/app/task/config.json +29 -0
  72. package/dist/app/task/form/bar/bar.js +1 -1
  73. package/dist/app/task/form/bar/bar.xml +1 -1
  74. package/dist/clickgo.js +1 -1
  75. package/dist/clickgo.ts +1 -1
  76. package/dist/control/common.cgc +0 -0
  77. package/dist/control/form.cgc +0 -0
  78. package/dist/control/monaco.cgc +0 -0
  79. package/dist/control/property.cgc +0 -0
  80. package/dist/control/task.cgc +0 -0
  81. package/dist/global.css +1 -1
  82. package/dist/index.js +6 -3
  83. package/dist/index.ts +9 -3
  84. package/dist/lib/control.js +70 -104
  85. package/dist/lib/control.ts +97 -123
  86. package/dist/lib/core.js +163 -253
  87. package/dist/lib/core.ts +185 -268
  88. package/dist/lib/dom.js +565 -484
  89. package/dist/lib/dom.ts +704 -547
  90. package/dist/lib/form.js +211 -159
  91. package/dist/lib/form.ts +196 -121
  92. package/dist/lib/fs.js +107 -12
  93. package/dist/lib/fs.ts +111 -20
  94. package/dist/lib/native.js +142 -8
  95. package/dist/lib/native.ts +181 -11
  96. package/dist/lib/task.js +526 -164
  97. package/dist/lib/task.ts +598 -179
  98. package/dist/lib/tool.js +48 -1
  99. package/dist/lib/tool.ts +61 -0
  100. package/dist/lib/zip.ts +2 -0
  101. package/dist/theme/familiar.cgt +0 -0
  102. package/package.json +2 -2
  103. package/types/index.d.ts +83 -39
  104. package/dist/app/demo/form/control/greatview/greatview.js +0 -92
  105. package/dist/app/demo/form/control/overflow/overflow.js +0 -70
  106. package/dist/app/demo/form/control/overflow/overflow.xml +0 -98
  107. package/dist/app/demo/form/control/view/view.css +0 -1
  108. package/dist/app/demo/form/control/view/view.js +0 -73
  109. package/dist/app/demo/form/control/view/view.scss +0 -18
  110. package/dist/app/demo/form/control/view/view.xml +0 -94
package/dist/lib/core.js CHANGED
@@ -9,16 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.initModules = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
12
+ exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
13
13
  const clickgo = require("../clickgo");
14
14
  const fs = require("./fs");
15
15
  const form = require("./form");
16
16
  const task = require("./task");
17
17
  const tool = require("./tool");
18
- const control = require("./control");
19
- const theme = require("./theme");
20
18
  const zip = require("./zip");
21
- const dom = require("./dom");
22
19
  const configOrigin = {
23
20
  'locale': 'en',
24
21
  'task.position': 'bottom',
@@ -53,147 +50,6 @@ class AbstractApp {
53
50
  'type': 'danger'
54
51
  });
55
52
  }
56
- config(config) {
57
- var _a;
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const t = task.list[this.taskId];
60
- if (!t) {
61
- return false;
62
- }
63
- t.config = config;
64
- if (t.app.net) {
65
- if (!t.config.files) {
66
- return false;
67
- }
68
- const files = t.config.files;
69
- const net = t.app.net;
70
- yield new Promise(function (resolve) {
71
- var _a;
72
- let loaded = 0;
73
- const total = files.length;
74
- const beforeTotal = Object.keys(t.app.files).length;
75
- (_a = net.progress) === null || _a === void 0 ? void 0 : _a.call(net, loaded + beforeTotal, total + beforeTotal);
76
- for (const file of files) {
77
- fs.getContent(net.url + file.slice(1), {
78
- 'current': net.current
79
- }).then(function (blob) {
80
- var _a;
81
- return __awaiter(this, void 0, void 0, function* () {
82
- if (blob === null || typeof blob === 'string') {
83
- clickgo.form.notify({
84
- 'title': 'File not found',
85
- 'content': net.url + file.slice(1),
86
- 'type': 'danger'
87
- });
88
- return;
89
- }
90
- const mime = tool.getMimeByPath(file);
91
- if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
92
- t.app.files[file] = (yield tool.blob2Text(blob)).replace(/^\ufeff/, '');
93
- }
94
- else {
95
- t.app.files[file] = blob;
96
- }
97
- ++loaded;
98
- (_a = net.progress) === null || _a === void 0 ? void 0 : _a.call(net, loaded + beforeTotal, total + beforeTotal);
99
- if (net.notify) {
100
- form.notifyProgress(net.notify, (loaded / total) / 2 + 0.5);
101
- }
102
- if (loaded < total) {
103
- return;
104
- }
105
- resolve();
106
- });
107
- }).catch(function () {
108
- var _a;
109
- ++loaded;
110
- (_a = net.progress) === null || _a === void 0 ? void 0 : _a.call(net, loaded + beforeTotal, total + beforeTotal);
111
- if (net.notify) {
112
- form.notifyProgress(net.notify, (loaded / total) / 2 + 0.5);
113
- }
114
- if (loaded < total) {
115
- return;
116
- }
117
- resolve();
118
- });
119
- }
120
- });
121
- if (net.notify) {
122
- setTimeout(function () {
123
- form.hideNotify(net.notify);
124
- }, 2000);
125
- }
126
- }
127
- if (!(yield control.init(this.taskId))) {
128
- return false;
129
- }
130
- if ((_a = config.themes) === null || _a === void 0 ? void 0 : _a.length) {
131
- for (let path of config.themes) {
132
- path += '.cgt';
133
- path = tool.urlResolve('/', path);
134
- const file = yield fs.getContent(path, {
135
- 'files': t.app.files,
136
- 'current': t.current
137
- });
138
- if (file && typeof file !== 'string') {
139
- const th = yield theme.read(file);
140
- if (th) {
141
- yield theme.load(th, t.id);
142
- }
143
- }
144
- }
145
- }
146
- else {
147
- if (theme.global) {
148
- yield theme.load(undefined, this.taskId);
149
- }
150
- }
151
- if (config.locales) {
152
- for (let path in config.locales) {
153
- const locale = config.locales[path];
154
- if (!path.endsWith('.json')) {
155
- path += '.json';
156
- }
157
- const lcontent = yield fs.getContent(path, {
158
- 'encoding': 'utf8',
159
- 'files': t.app.files,
160
- 'current': t.current
161
- });
162
- if (!lcontent) {
163
- continue;
164
- }
165
- try {
166
- const data = JSON.parse(lcontent);
167
- task.loadLocaleData(locale, data, '', t.id);
168
- }
169
- catch (_b) {
170
- }
171
- }
172
- }
173
- if (config.style) {
174
- const style = yield fs.getContent(config.style + '.css', {
175
- 'encoding': 'utf8',
176
- 'files': t.app.files,
177
- 'current': t.current
178
- });
179
- if (style) {
180
- const r = tool.stylePrepend(style, 'cg-task' + this.taskId.toString() + '_');
181
- dom.pushStyle(this.taskId, yield tool.styleUrl2DataUrl(config.style, r.style, t.app.files));
182
- }
183
- }
184
- if (config.icon) {
185
- const icon = yield fs.getContent(config.icon, {
186
- 'files': t.app.files,
187
- 'current': t.current
188
- });
189
- if (icon && typeof icon !== 'string') {
190
- t.app.icon = yield tool.blob2DataUrl(icon);
191
- }
192
- }
193
- t.class = this;
194
- return true;
195
- });
196
- }
197
53
  run(form) {
198
54
  if (typeof form === 'number') {
199
55
  const msg = 'Application run error, Form creation failed (' + form.toString() + ').';
@@ -250,6 +106,9 @@ class AbstractApp {
250
106
  onLauncherFolderNameChanged() {
251
107
  return;
252
108
  }
109
+ onHashChanged() {
110
+ return;
111
+ }
253
112
  }
254
113
  exports.AbstractApp = AbstractApp;
255
114
  function getCdn() {
@@ -322,7 +181,8 @@ const modules = {
322
181
  });
323
182
  },
324
183
  'obj': null,
325
- 'loading': false
184
+ 'loading': false,
185
+ 'resolve': []
326
186
  }
327
187
  };
328
188
  function regModule(name, func) {
@@ -332,87 +192,53 @@ function regModule(name, func) {
332
192
  modules[name] = {
333
193
  func: func,
334
194
  'obj': null,
335
- 'loading': false
195
+ 'loading': false,
196
+ 'resolve': []
336
197
  };
337
198
  return true;
338
199
  }
339
200
  exports.regModule = regModule;
340
- function initModules(names) {
341
- return new Promise(function (resolve) {
342
- if (typeof names === 'string') {
343
- names = [names];
344
- }
345
- if (names.length === 0) {
346
- resolve(0);
347
- return;
201
+ function getModule(name) {
202
+ return new Promise((resolve) => {
203
+ if (!modules[name]) {
204
+ return null;
348
205
  }
349
- let loaded = 0;
350
- let successful = 0;
351
- for (const name of names) {
352
- if (!modules[name]) {
353
- ++loaded;
354
- if (loaded === names.length) {
355
- resolve(successful);
356
- return;
357
- }
358
- continue;
359
- }
360
- if (modules[name].obj) {
361
- ++loaded;
362
- ++successful;
363
- if (loaded === names.length) {
364
- resolve(successful);
365
- return;
366
- }
367
- continue;
368
- }
206
+ if (!modules[name].obj) {
369
207
  if (modules[name].loading) {
370
- ++loaded;
371
- if (loaded === names.length) {
372
- resolve(successful);
373
- return;
374
- }
375
- continue;
376
- }
377
- modules[name].loading = true;
378
- const rtn = modules[name].func();
379
- if (rtn instanceof Promise) {
380
- rtn.then(function (obj) {
381
- modules[name].obj = obj;
382
- modules[name].loading = false;
383
- ++loaded;
384
- ++successful;
385
- if (loaded === names.length) {
386
- resolve(successful);
387
- return;
388
- }
389
- }).catch(function () {
390
- modules[name].loading = false;
391
- ++loaded;
392
- if (loaded === names.length) {
393
- resolve(successful);
394
- }
208
+ modules[name].resolve.push(() => {
209
+ resolve(modules[name].obj);
395
210
  });
396
211
  }
397
212
  else {
398
- modules[name].obj = rtn;
399
- modules[name].loading = false;
400
- ++loaded;
401
- ++successful;
402
- if (loaded === names.length) {
403
- resolve(successful);
213
+ const rtn = modules[name].func();
214
+ if (rtn instanceof Promise) {
215
+ modules[name].loading = true;
216
+ rtn.then(function (obj) {
217
+ modules[name].obj = obj;
218
+ modules[name].loading = false;
219
+ resolve(obj);
220
+ for (const r of modules[name].resolve) {
221
+ r();
222
+ }
223
+ }).catch(function () {
224
+ modules[name].loading = false;
225
+ resolve(null);
226
+ for (const r of modules[name].resolve) {
227
+ r();
228
+ }
229
+ });
230
+ }
231
+ else {
232
+ modules[name].obj = rtn;
233
+ resolve(rtn);
404
234
  }
405
235
  }
236
+ return;
406
237
  }
238
+ resolve(modules[name].obj);
239
+ return;
407
240
  });
408
241
  }
409
- exports.initModules = initModules;
410
- function getModule(name) {
411
- if (!modules[name]) {
412
- return null;
413
- }
414
- return modules[name].obj;
415
- }
416
242
  exports.getModule = getModule;
417
243
  const globalEvents = {
418
244
  screenResize: function () {
@@ -459,7 +285,7 @@ const globalEvents = {
459
285
  }
460
286
  };
461
287
  function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
462
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
288
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
463
289
  const eventName = 'on' + name[0].toUpperCase() + name.slice(1);
464
290
  switch (name) {
465
291
  case 'error': {
@@ -573,7 +399,7 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
573
399
  if (typeof formId !== 'string') {
574
400
  break;
575
401
  }
576
- if (typeof taskId === 'number') {
402
+ if (typeof taskId !== 'string') {
577
403
  taskId = taskId.toString();
578
404
  }
579
405
  exports.boot[eventName](taskId, formId);
@@ -586,6 +412,20 @@ function trigger(name, taskId = 0, formId = 0, param1 = '', param2 = '') {
586
412
  }
587
413
  break;
588
414
  }
415
+ case 'hashChanged': {
416
+ if (typeof taskId !== 'string') {
417
+ break;
418
+ }
419
+ exports.boot[eventName](taskId);
420
+ for (const tid in task.list) {
421
+ const t = task.list[tid];
422
+ (_13 = t.class) === null || _13 === void 0 ? void 0 : _13[eventName](taskId);
423
+ for (const fid in t.forms) {
424
+ (_15 = (_14 = t.forms[fid].vroot)[eventName]) === null || _15 === void 0 ? void 0 : _15.call(_14, taskId);
425
+ }
426
+ }
427
+ break;
428
+ }
589
429
  }
590
430
  }
591
431
  exports.trigger = trigger;
@@ -598,6 +438,11 @@ function readApp(blob) {
598
438
  return false;
599
439
  }
600
440
  const files = {};
441
+ const configContent = yield z.getContent('/config.json');
442
+ if (!configContent) {
443
+ return false;
444
+ }
445
+ const config = JSON.parse(configContent);
601
446
  const list = z.readDir('/', {
602
447
  'hasChildren': true
603
448
  });
@@ -621,8 +466,10 @@ function readApp(blob) {
621
466
  }
622
467
  }
623
468
  return {
624
- 'icon': icon,
625
- 'files': files
469
+ 'type': 'app',
470
+ 'config': config,
471
+ 'files': files,
472
+ 'icon': icon
626
473
  };
627
474
  });
628
475
  }
@@ -679,50 +526,95 @@ function fetchApp(url, opt = {}) {
679
526
  return null;
680
527
  }
681
528
  }
682
- let loaded = 0;
683
- let total = 30;
684
- const files = yield loader.sniffFiles(url + 'app.js', {
685
- 'dir': '/',
686
- adapter: (url) => __awaiter(this, void 0, void 0, function* () {
687
- const r = yield fs.getContent(url, {
688
- 'encoding': 'utf8',
689
- 'current': current
690
- });
691
- return r;
692
- }),
693
- 'loaded': () => {
694
- ++loaded;
695
- if (loaded === total) {
696
- ++total;
697
- }
698
- if (opt.notifyId) {
699
- form.notifyProgress(opt.notifyId, (loaded / total) / 2);
529
+ let config;
530
+ const files = {};
531
+ try {
532
+ const blob = yield fs.getContent(url + 'config.json', {
533
+ 'current': current
534
+ });
535
+ if (blob === null || typeof blob === 'string') {
536
+ return null;
537
+ }
538
+ config = JSON.parse(yield tool.blob2Text(blob));
539
+ yield new Promise(function (resolve) {
540
+ if (!config.files) {
541
+ return;
700
542
  }
543
+ const total = config.files.length;
544
+ let loaded = 0;
701
545
  if (opt.progress) {
702
- opt.progress(loaded, total);
546
+ opt.progress(loaded + 1, total + 1);
703
547
  }
704
- }
705
- });
706
- if (opt.notifyId) {
707
- form.notifyProgress(opt.notifyId, 0.5);
548
+ for (const file of config.files) {
549
+ fs.getContent(url + file.slice(1), {
550
+ 'current': current
551
+ }).then(function (blob) {
552
+ return __awaiter(this, void 0, void 0, function* () {
553
+ if (blob === null || typeof blob === 'string') {
554
+ clickgo.form.notify({
555
+ 'title': 'File not found',
556
+ 'content': url + file.slice(1),
557
+ 'type': 'danger'
558
+ });
559
+ return;
560
+ }
561
+ const mime = tool.getMimeByPath(file);
562
+ if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
563
+ files[file] = (yield tool.blob2Text(blob)).replace(/^\ufeff/, '');
564
+ }
565
+ else {
566
+ files[file] = blob;
567
+ }
568
+ ++loaded;
569
+ if (opt.notifyId) {
570
+ form.notifyProgress(opt.notifyId, loaded / total);
571
+ }
572
+ if (opt.progress) {
573
+ opt.progress(loaded + 1, total + 1);
574
+ }
575
+ if (loaded < total) {
576
+ return;
577
+ }
578
+ resolve();
579
+ });
580
+ }).catch(function () {
581
+ ++loaded;
582
+ if (opt.notifyId) {
583
+ form.notifyProgress(opt.notifyId, loaded / total);
584
+ }
585
+ if (opt.progress) {
586
+ opt.progress(loaded + 1, total + 1);
587
+ }
588
+ if (loaded < total) {
589
+ return;
590
+ }
591
+ resolve();
592
+ });
593
+ }
594
+ });
708
595
  }
709
- if (Object.keys(files).length === 0) {
596
+ catch (e) {
597
+ console.log('core.fetchApp', e);
598
+ trigger('error', 0, 0, e, e.message);
710
599
  return null;
711
600
  }
712
- const ul = url.length - 1;
713
- for (const fn in files) {
714
- files[fn.slice(ul)] = files[fn];
715
- delete files[fn];
601
+ let icon = '';
602
+ if (config.icon && (files[config.icon] instanceof Blob)) {
603
+ icon = yield tool.blob2DataUrl(files[config.icon]);
604
+ }
605
+ if (icon === '') {
606
+ const iconBlob = yield fs.getContent('/clickgo/icon.png', {
607
+ 'current': current
608
+ });
609
+ if (iconBlob instanceof Blob) {
610
+ icon = yield tool.blob2DataUrl(iconBlob);
611
+ }
716
612
  }
717
613
  return {
718
- 'net': {
719
- 'current': current,
720
- 'notify': opt.notifyId,
721
- 'url': url,
722
- 'progress': opt.progress
723
- },
724
- 'icon': '',
725
- 'files': files
614
+ 'type': 'app',
615
+ 'config': config,
616
+ 'files': files,
617
+ 'icon': icon
726
618
  };
727
619
  });
728
620
  }
@@ -779,3 +671,21 @@ function getAvailArea() {
779
671
  }
780
672
  }
781
673
  exports.getAvailArea = getAvailArea;
674
+ function hash(hash, taskId) {
675
+ if (!taskId) {
676
+ return false;
677
+ }
678
+ const t = task.list[taskId];
679
+ if (!t) {
680
+ return false;
681
+ }
682
+ if (!t.runtime.permissions.includes('root') && !t.runtime.permissions.includes('hash')) {
683
+ return false;
684
+ }
685
+ window.location.hash = hash;
686
+ return true;
687
+ }
688
+ exports.hash = hash;
689
+ window.addEventListener('hashchange', function () {
690
+ trigger('hashChanged', window.location.hash ? window.location.hash.slice(1) : '');
691
+ });