@eva/eva.js 1.2.7-fix.4 → 1.2.7-fix.6
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/dist/EVA.js +1017 -246
- package/dist/EVA.js.map +1 -0
- package/dist/EVA.min.js +1 -1
- package/dist/eva.js.cjs.js +5 -112
- package/dist/eva.js.cjs.js.map +1 -0
- package/dist/eva.js.cjs.prod.js +2 -2
- package/dist/eva.js.d.ts +1 -12
- package/dist/eva.js.esm.js +4 -111
- package/dist/eva.js.esm.js.map +1 -0
- package/dist/miniprogram.js +722 -54
- package/package.json +1 -1
package/dist/EVA.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
2
3
|
var _EVA_IIFE_EVA = function (exports) {
|
|
3
4
|
'use strict';
|
|
4
5
|
|
|
@@ -12,30 +13,37 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
12
13
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
13
14
|
}
|
|
14
15
|
};
|
|
16
|
+
|
|
15
17
|
return _extendStatics$(d, b);
|
|
16
18
|
};
|
|
19
|
+
|
|
17
20
|
function __extends$1(d, b) {
|
|
18
21
|
_extendStatics$(d, b);
|
|
22
|
+
|
|
19
23
|
function __() {
|
|
20
24
|
this.constructor = d;
|
|
21
25
|
}
|
|
26
|
+
|
|
22
27
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
23
28
|
}
|
|
29
|
+
|
|
24
30
|
function __decorate(decorators, target, key, desc) {
|
|
25
31
|
var c = arguments.length,
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
33
|
+
d;
|
|
28
34
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
|
29
35
|
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30
36
|
}
|
|
31
37
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
38
|
}
|
|
39
|
+
|
|
33
40
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
34
41
|
function adopt(value) {
|
|
35
42
|
return value instanceof P ? value : new P(function (resolve) {
|
|
36
43
|
resolve(value);
|
|
37
44
|
});
|
|
38
45
|
}
|
|
46
|
+
|
|
39
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
48
|
function fulfilled(value) {
|
|
41
49
|
try {
|
|
@@ -44,6 +52,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
44
52
|
reject(e);
|
|
45
53
|
}
|
|
46
54
|
}
|
|
55
|
+
|
|
47
56
|
function rejected(value) {
|
|
48
57
|
try {
|
|
49
58
|
step(generator["throw"](value));
|
|
@@ -51,26 +60,29 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
51
60
|
reject(e);
|
|
52
61
|
}
|
|
53
62
|
}
|
|
63
|
+
|
|
54
64
|
function step(result) {
|
|
55
65
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
56
66
|
}
|
|
67
|
+
|
|
57
68
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58
69
|
});
|
|
59
70
|
}
|
|
71
|
+
|
|
60
72
|
function __generator(thisArg, body) {
|
|
61
73
|
var _ = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
trys: [],
|
|
68
|
-
ops: []
|
|
74
|
+
label: 0,
|
|
75
|
+
sent: function sent() {
|
|
76
|
+
if (t[0] & 1) throw t[1];
|
|
77
|
+
return t[1];
|
|
69
78
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
trys: [],
|
|
80
|
+
ops: []
|
|
81
|
+
},
|
|
82
|
+
f,
|
|
83
|
+
y,
|
|
84
|
+
t,
|
|
85
|
+
g;
|
|
74
86
|
return g = {
|
|
75
87
|
next: verb(0),
|
|
76
88
|
"throw": verb(1),
|
|
@@ -78,60 +90,79 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
78
90
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
79
91
|
return this;
|
|
80
92
|
}), g;
|
|
93
|
+
|
|
81
94
|
function verb(n) {
|
|
82
95
|
return function (v) {
|
|
83
96
|
return step([n, v]);
|
|
84
97
|
};
|
|
85
98
|
}
|
|
99
|
+
|
|
86
100
|
function step(op) {
|
|
87
101
|
if (f) throw new TypeError("Generator is already executing.");
|
|
102
|
+
|
|
88
103
|
while (_) {
|
|
89
104
|
try {
|
|
90
105
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
91
106
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
107
|
+
|
|
92
108
|
switch (op[0]) {
|
|
93
109
|
case 0:
|
|
94
110
|
case 1:
|
|
95
111
|
t = op;
|
|
96
112
|
break;
|
|
113
|
+
|
|
97
114
|
case 4:
|
|
98
115
|
_.label++;
|
|
99
116
|
return {
|
|
100
117
|
value: op[1],
|
|
101
118
|
done: false
|
|
102
119
|
};
|
|
120
|
+
|
|
103
121
|
case 5:
|
|
104
122
|
_.label++;
|
|
105
123
|
y = op[1];
|
|
106
124
|
op = [0];
|
|
107
125
|
continue;
|
|
126
|
+
|
|
108
127
|
case 7:
|
|
109
128
|
op = _.ops.pop();
|
|
129
|
+
|
|
110
130
|
_.trys.pop();
|
|
131
|
+
|
|
111
132
|
continue;
|
|
133
|
+
|
|
112
134
|
default:
|
|
113
135
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
114
136
|
_ = 0;
|
|
115
137
|
continue;
|
|
116
138
|
}
|
|
139
|
+
|
|
117
140
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
118
141
|
_.label = op[1];
|
|
119
142
|
break;
|
|
120
143
|
}
|
|
144
|
+
|
|
121
145
|
if (op[0] === 6 && _.label < t[1]) {
|
|
122
146
|
_.label = t[1];
|
|
123
147
|
t = op;
|
|
124
148
|
break;
|
|
125
149
|
}
|
|
150
|
+
|
|
126
151
|
if (t && _.label < t[2]) {
|
|
127
152
|
_.label = t[2];
|
|
153
|
+
|
|
128
154
|
_.ops.push(op);
|
|
155
|
+
|
|
129
156
|
break;
|
|
130
157
|
}
|
|
158
|
+
|
|
131
159
|
if (t[2]) _.ops.pop();
|
|
160
|
+
|
|
132
161
|
_.trys.pop();
|
|
162
|
+
|
|
133
163
|
continue;
|
|
134
164
|
}
|
|
165
|
+
|
|
135
166
|
op = body.call(thisArg, _);
|
|
136
167
|
} catch (e) {
|
|
137
168
|
op = [6, e];
|
|
@@ -140,6 +171,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
140
171
|
f = t = 0;
|
|
141
172
|
}
|
|
142
173
|
}
|
|
174
|
+
|
|
143
175
|
if (op[0] & 5) throw op[1];
|
|
144
176
|
return {
|
|
145
177
|
value: op[0] ? op[1] : void 0,
|
|
@@ -147,10 +179,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
147
179
|
};
|
|
148
180
|
}
|
|
149
181
|
}
|
|
182
|
+
|
|
150
183
|
function __values(o) {
|
|
151
184
|
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
152
|
-
|
|
153
|
-
|
|
185
|
+
m = s && o[s],
|
|
186
|
+
i = 0;
|
|
154
187
|
if (m) return m.call(o);
|
|
155
188
|
if (o && typeof o.length === "number") return {
|
|
156
189
|
next: function next() {
|
|
@@ -163,13 +196,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
163
196
|
};
|
|
164
197
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
165
198
|
}
|
|
199
|
+
|
|
166
200
|
function __read(o, n) {
|
|
167
201
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
168
202
|
if (!m) return o;
|
|
169
203
|
var i = m.call(o),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
204
|
+
r,
|
|
205
|
+
ar = [],
|
|
206
|
+
e;
|
|
207
|
+
|
|
173
208
|
try {
|
|
174
209
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
175
210
|
ar.push(r.value);
|
|
@@ -185,29 +220,33 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
185
220
|
if (e) throw e.error;
|
|
186
221
|
}
|
|
187
222
|
}
|
|
223
|
+
|
|
188
224
|
return ar;
|
|
189
225
|
}
|
|
226
|
+
|
|
190
227
|
function __spread() {
|
|
191
228
|
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
192
229
|
ar = ar.concat(__read(arguments[i]));
|
|
193
230
|
}
|
|
231
|
+
|
|
194
232
|
return ar;
|
|
195
233
|
}
|
|
234
|
+
|
|
196
235
|
function createCommonjsModule(fn) {
|
|
197
236
|
var module = {
|
|
198
237
|
exports: {}
|
|
199
238
|
};
|
|
200
239
|
return fn(module, module.exports), module.exports;
|
|
201
240
|
}
|
|
241
|
+
|
|
202
242
|
var eventemitter3 = createCommonjsModule(function (module) {
|
|
203
243
|
var has = Object.prototype.hasOwnProperty,
|
|
204
|
-
|
|
244
|
+
prefix = '~';
|
|
205
245
|
|
|
206
246
|
function Events() {}
|
|
207
247
|
|
|
208
248
|
if (Object.create) {
|
|
209
249
|
Events.prototype = Object.create(null);
|
|
210
|
-
|
|
211
250
|
if (!new Events().__proto__) prefix = false;
|
|
212
251
|
}
|
|
213
252
|
|
|
@@ -221,8 +260,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
221
260
|
if (typeof fn !== 'function') {
|
|
222
261
|
throw new TypeError('The listener must be a function');
|
|
223
262
|
}
|
|
263
|
+
|
|
224
264
|
var listener = new EE(fn, context || emitter, once),
|
|
225
|
-
|
|
265
|
+
evt = prefix ? prefix + event : event;
|
|
226
266
|
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
|
|
227
267
|
return emitter;
|
|
228
268
|
}
|
|
@@ -238,32 +278,37 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
238
278
|
|
|
239
279
|
EventEmitter.prototype.eventNames = function eventNames() {
|
|
240
280
|
var names = [],
|
|
241
|
-
|
|
242
|
-
|
|
281
|
+
events,
|
|
282
|
+
name;
|
|
243
283
|
if (this._eventsCount === 0) return names;
|
|
284
|
+
|
|
244
285
|
for (name in events = this._events) {
|
|
245
286
|
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
246
287
|
}
|
|
288
|
+
|
|
247
289
|
if (Object.getOwnPropertySymbols) {
|
|
248
290
|
return names.concat(Object.getOwnPropertySymbols(events));
|
|
249
291
|
}
|
|
292
|
+
|
|
250
293
|
return names;
|
|
251
294
|
};
|
|
252
295
|
|
|
253
296
|
EventEmitter.prototype.listeners = function listeners(event) {
|
|
254
297
|
var evt = prefix ? prefix + event : event,
|
|
255
|
-
|
|
298
|
+
handlers = this._events[evt];
|
|
256
299
|
if (!handlers) return [];
|
|
257
300
|
if (handlers.fn) return [handlers.fn];
|
|
301
|
+
|
|
258
302
|
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
259
303
|
ee[i] = handlers[i].fn;
|
|
260
304
|
}
|
|
305
|
+
|
|
261
306
|
return ee;
|
|
262
307
|
};
|
|
263
308
|
|
|
264
309
|
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
265
310
|
var evt = prefix ? prefix + event : event,
|
|
266
|
-
|
|
311
|
+
listeners = this._events[evt];
|
|
267
312
|
if (!listeners) return 0;
|
|
268
313
|
if (listeners.fn) return 1;
|
|
269
314
|
return listeners.length;
|
|
@@ -273,47 +318,62 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
273
318
|
var evt = prefix ? prefix + event : event;
|
|
274
319
|
if (!this._events[evt]) return false;
|
|
275
320
|
var listeners = this._events[evt],
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
321
|
+
len = arguments.length,
|
|
322
|
+
args,
|
|
323
|
+
i;
|
|
324
|
+
|
|
279
325
|
if (listeners.fn) {
|
|
280
326
|
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
327
|
+
|
|
281
328
|
switch (len) {
|
|
282
329
|
case 1:
|
|
283
330
|
return listeners.fn.call(listeners.context), true;
|
|
331
|
+
|
|
284
332
|
case 2:
|
|
285
333
|
return listeners.fn.call(listeners.context, a1), true;
|
|
334
|
+
|
|
286
335
|
case 3:
|
|
287
336
|
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
337
|
+
|
|
288
338
|
case 4:
|
|
289
339
|
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
340
|
+
|
|
290
341
|
case 5:
|
|
291
342
|
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
343
|
+
|
|
292
344
|
case 6:
|
|
293
345
|
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
294
346
|
}
|
|
347
|
+
|
|
295
348
|
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
296
349
|
args[i - 1] = arguments[i];
|
|
297
350
|
}
|
|
351
|
+
|
|
298
352
|
listeners.fn.apply(listeners.context, args);
|
|
299
353
|
} else {
|
|
300
354
|
var length = listeners.length,
|
|
301
|
-
|
|
355
|
+
j;
|
|
356
|
+
|
|
302
357
|
for (i = 0; i < length; i++) {
|
|
303
358
|
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
359
|
+
|
|
304
360
|
switch (len) {
|
|
305
361
|
case 1:
|
|
306
362
|
listeners[i].fn.call(listeners[i].context);
|
|
307
363
|
break;
|
|
364
|
+
|
|
308
365
|
case 2:
|
|
309
366
|
listeners[i].fn.call(listeners[i].context, a1);
|
|
310
367
|
break;
|
|
368
|
+
|
|
311
369
|
case 3:
|
|
312
370
|
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
313
371
|
break;
|
|
372
|
+
|
|
314
373
|
case 4:
|
|
315
374
|
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
316
375
|
break;
|
|
376
|
+
|
|
317
377
|
default:
|
|
318
378
|
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
319
379
|
args[j - 1] = arguments[j];
|
|
@@ -322,6 +382,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
322
382
|
}
|
|
323
383
|
}
|
|
324
384
|
}
|
|
385
|
+
|
|
325
386
|
return true;
|
|
326
387
|
};
|
|
327
388
|
|
|
@@ -336,11 +397,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
336
397
|
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
337
398
|
var evt = prefix ? prefix + event : event;
|
|
338
399
|
if (!this._events[evt]) return this;
|
|
400
|
+
|
|
339
401
|
if (!fn) {
|
|
340
402
|
clearEvent(this, evt);
|
|
341
403
|
return this;
|
|
342
404
|
}
|
|
405
|
+
|
|
343
406
|
var listeners = this._events[evt];
|
|
407
|
+
|
|
344
408
|
if (listeners.fn) {
|
|
345
409
|
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
346
410
|
clearEvent(this, evt);
|
|
@@ -354,11 +418,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
354
418
|
|
|
355
419
|
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
|
|
356
420
|
}
|
|
421
|
+
|
|
357
422
|
return this;
|
|
358
423
|
};
|
|
359
424
|
|
|
360
425
|
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
361
426
|
var evt;
|
|
427
|
+
|
|
362
428
|
if (event) {
|
|
363
429
|
evt = prefix ? prefix + event : event;
|
|
364
430
|
if (this._events[evt]) clearEvent(this, evt);
|
|
@@ -366,21 +432,20 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
366
432
|
this._events = new Events();
|
|
367
433
|
this._eventsCount = 0;
|
|
368
434
|
}
|
|
435
|
+
|
|
369
436
|
return this;
|
|
370
437
|
};
|
|
371
438
|
|
|
372
439
|
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
373
440
|
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
374
|
-
|
|
375
441
|
EventEmitter.prefixed = prefix;
|
|
376
|
-
|
|
377
442
|
EventEmitter.EventEmitter = EventEmitter;
|
|
378
|
-
|
|
379
443
|
{
|
|
380
444
|
module.exports = EventEmitter;
|
|
381
445
|
}
|
|
382
446
|
});
|
|
383
447
|
var EE = eventemitter3;
|
|
448
|
+
|
|
384
449
|
function getComponentName(component) {
|
|
385
450
|
if (component instanceof Component) {
|
|
386
451
|
return component.name;
|
|
@@ -388,46 +453,46 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
388
453
|
return component.componentName;
|
|
389
454
|
}
|
|
390
455
|
}
|
|
456
|
+
|
|
391
457
|
var Component = function (_super) {
|
|
392
458
|
__extends$1(Component, _super);
|
|
459
|
+
|
|
393
460
|
function Component(params) {
|
|
394
461
|
var _this = _super.call(this) || this;
|
|
462
|
+
|
|
395
463
|
_this.started = false;
|
|
396
464
|
_this.name = _this.constructor.componentName;
|
|
397
465
|
_this.__componentDefaultParams = params;
|
|
398
466
|
return _this;
|
|
399
467
|
}
|
|
468
|
+
|
|
400
469
|
return Component;
|
|
401
470
|
}(EE);
|
|
402
|
-
var Component$1 = Component;
|
|
403
471
|
|
|
472
|
+
var Component$1 = Component;
|
|
404
473
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
405
474
|
var freeGlobal$1 = freeGlobal;
|
|
406
|
-
|
|
407
475
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
408
|
-
|
|
409
476
|
var root = freeGlobal$1 || freeSelf || Function('return this')();
|
|
410
477
|
var root$1 = root;
|
|
411
|
-
|
|
412
478
|
var Symbol$1 = root$1.Symbol;
|
|
413
479
|
var Symbol$2 = Symbol$1;
|
|
414
|
-
|
|
415
480
|
var objectProto$b = Object.prototype;
|
|
416
|
-
|
|
417
481
|
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
418
|
-
|
|
419
482
|
var nativeObjectToString$1 = objectProto$b.toString;
|
|
420
|
-
|
|
421
483
|
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
422
484
|
|
|
423
485
|
function getRawTag(value) {
|
|
424
486
|
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
425
|
-
|
|
487
|
+
tag = value[symToStringTag$1];
|
|
488
|
+
|
|
426
489
|
try {
|
|
427
490
|
value[symToStringTag$1] = undefined;
|
|
428
491
|
var unmasked = true;
|
|
429
492
|
} catch (e) {}
|
|
493
|
+
|
|
430
494
|
var result = nativeObjectToString$1.call(value);
|
|
495
|
+
|
|
431
496
|
if (unmasked) {
|
|
432
497
|
if (isOwn) {
|
|
433
498
|
value[symToStringTag$1] = tag;
|
|
@@ -435,11 +500,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
435
500
|
delete value[symToStringTag$1];
|
|
436
501
|
}
|
|
437
502
|
}
|
|
503
|
+
|
|
438
504
|
return result;
|
|
439
505
|
}
|
|
440
506
|
|
|
441
507
|
var objectProto$a = Object.prototype;
|
|
442
|
-
|
|
443
508
|
var nativeObjectToString = objectProto$a.toString;
|
|
444
509
|
|
|
445
510
|
function objectToString(value) {
|
|
@@ -447,14 +512,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
447
512
|
}
|
|
448
513
|
|
|
449
514
|
var nullTag = '[object Null]',
|
|
450
|
-
|
|
451
|
-
|
|
515
|
+
undefinedTag = '[object Undefined]';
|
|
452
516
|
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
453
517
|
|
|
454
518
|
function baseGetTag(value) {
|
|
455
519
|
if (value == null) {
|
|
456
520
|
return value === undefined ? undefinedTag : nullTag;
|
|
457
521
|
}
|
|
522
|
+
|
|
458
523
|
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
459
524
|
}
|
|
460
525
|
|
|
@@ -471,14 +536,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
471
536
|
}
|
|
472
537
|
|
|
473
538
|
var asyncTag = '[object AsyncFunction]',
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
539
|
+
funcTag$1 = '[object Function]',
|
|
540
|
+
genTag = '[object GeneratorFunction]',
|
|
541
|
+
proxyTag = '[object Proxy]';
|
|
477
542
|
|
|
478
543
|
function isFunction(value) {
|
|
479
544
|
if (!isObject(value)) {
|
|
480
545
|
return false;
|
|
481
546
|
}
|
|
547
|
+
|
|
482
548
|
var tag = baseGetTag(value);
|
|
483
549
|
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
484
550
|
}
|
|
@@ -496,7 +562,6 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
496
562
|
}
|
|
497
563
|
|
|
498
564
|
var funcProto$1 = Function.prototype;
|
|
499
|
-
|
|
500
565
|
var funcToString$1 = funcProto$1.toString;
|
|
501
566
|
|
|
502
567
|
function toSource(func) {
|
|
@@ -504,30 +569,28 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
504
569
|
try {
|
|
505
570
|
return funcToString$1.call(func);
|
|
506
571
|
} catch (e) {}
|
|
572
|
+
|
|
507
573
|
try {
|
|
508
574
|
return func + '';
|
|
509
575
|
} catch (e) {}
|
|
510
576
|
}
|
|
577
|
+
|
|
511
578
|
return '';
|
|
512
579
|
}
|
|
513
580
|
|
|
514
581
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
515
|
-
|
|
516
582
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
517
|
-
|
|
518
583
|
var funcProto = Function.prototype,
|
|
519
|
-
|
|
520
|
-
|
|
584
|
+
objectProto$9 = Object.prototype;
|
|
521
585
|
var funcToString = funcProto.toString;
|
|
522
|
-
|
|
523
586
|
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
524
|
-
|
|
525
587
|
var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
526
588
|
|
|
527
589
|
function baseIsNative(value) {
|
|
528
590
|
if (!isObject(value) || isMasked(value)) {
|
|
529
591
|
return false;
|
|
530
592
|
}
|
|
593
|
+
|
|
531
594
|
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
532
595
|
return pattern.test(toSource(value));
|
|
533
596
|
}
|
|
@@ -543,9 +606,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
543
606
|
|
|
544
607
|
var WeakMap = getNative(root$1, 'WeakMap');
|
|
545
608
|
var WeakMap$1 = WeakMap;
|
|
546
|
-
|
|
547
609
|
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
548
|
-
|
|
549
610
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
550
611
|
|
|
551
612
|
function isIndex(value, length) {
|
|
@@ -572,16 +633,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
572
633
|
|
|
573
634
|
function isPrototype(value) {
|
|
574
635
|
var Ctor = value && value.constructor,
|
|
575
|
-
|
|
636
|
+
proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$8;
|
|
576
637
|
return value === proto;
|
|
577
638
|
}
|
|
578
639
|
|
|
579
640
|
function baseTimes(n, iteratee) {
|
|
580
641
|
var index = -1,
|
|
581
|
-
|
|
642
|
+
result = Array(n);
|
|
643
|
+
|
|
582
644
|
while (++index < n) {
|
|
583
645
|
result[index] = iteratee(index);
|
|
584
646
|
}
|
|
647
|
+
|
|
585
648
|
return result;
|
|
586
649
|
}
|
|
587
650
|
|
|
@@ -592,11 +655,8 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
592
655
|
}
|
|
593
656
|
|
|
594
657
|
var objectProto$7 = Object.prototype;
|
|
595
|
-
|
|
596
658
|
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
597
|
-
|
|
598
659
|
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
599
|
-
|
|
600
660
|
var isArguments = baseIsArguments(function () {
|
|
601
661
|
return arguments;
|
|
602
662
|
}()) ? baseIsArguments : function (value) {
|
|
@@ -609,43 +669,36 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
609
669
|
}
|
|
610
670
|
|
|
611
671
|
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
612
|
-
|
|
613
672
|
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
614
|
-
|
|
615
673
|
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
616
|
-
|
|
617
674
|
var Buffer = moduleExports$1 ? root$1.Buffer : undefined;
|
|
618
|
-
|
|
619
675
|
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
620
|
-
|
|
621
676
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
622
677
|
var isBuffer$1 = isBuffer;
|
|
623
|
-
|
|
624
678
|
var argsTag$1 = '[object Arguments]',
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
679
|
+
arrayTag$1 = '[object Array]',
|
|
680
|
+
boolTag$1 = '[object Boolean]',
|
|
681
|
+
dateTag$1 = '[object Date]',
|
|
682
|
+
errorTag$1 = '[object Error]',
|
|
683
|
+
funcTag = '[object Function]',
|
|
684
|
+
mapTag$2 = '[object Map]',
|
|
685
|
+
numberTag$1 = '[object Number]',
|
|
686
|
+
objectTag$2 = '[object Object]',
|
|
687
|
+
regexpTag$1 = '[object RegExp]',
|
|
688
|
+
setTag$2 = '[object Set]',
|
|
689
|
+
stringTag$1 = '[object String]',
|
|
690
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
637
691
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
692
|
+
dataViewTag$2 = '[object DataView]',
|
|
693
|
+
float32Tag = '[object Float32Array]',
|
|
694
|
+
float64Tag = '[object Float64Array]',
|
|
695
|
+
int8Tag = '[object Int8Array]',
|
|
696
|
+
int16Tag = '[object Int16Array]',
|
|
697
|
+
int32Tag = '[object Int32Array]',
|
|
698
|
+
uint8Tag = '[object Uint8Array]',
|
|
699
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
700
|
+
uint16Tag = '[object Uint16Array]',
|
|
701
|
+
uint32Tag = '[object Uint32Array]';
|
|
649
702
|
var typedArrayTags = {};
|
|
650
703
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
651
704
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
@@ -661,16 +714,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
661
714
|
}
|
|
662
715
|
|
|
663
716
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
664
|
-
|
|
665
717
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
666
|
-
|
|
667
718
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
668
|
-
|
|
669
719
|
var freeProcess = moduleExports && freeGlobal$1.process;
|
|
670
720
|
|
|
671
721
|
var nodeUtil = function () {
|
|
672
722
|
try {
|
|
673
723
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
724
|
+
|
|
674
725
|
if (types) {
|
|
675
726
|
return types;
|
|
676
727
|
}
|
|
@@ -678,34 +729,29 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
678
729
|
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
679
730
|
} catch (e) {}
|
|
680
731
|
}();
|
|
681
|
-
var nodeUtil$1 = nodeUtil;
|
|
682
732
|
|
|
733
|
+
var nodeUtil$1 = nodeUtil;
|
|
683
734
|
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
|
|
684
|
-
|
|
685
735
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
686
736
|
var isTypedArray$1 = isTypedArray;
|
|
687
|
-
|
|
688
737
|
var objectProto$6 = Object.prototype;
|
|
689
|
-
|
|
690
738
|
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
691
739
|
|
|
692
740
|
function arrayLikeKeys(value, inherited) {
|
|
693
741
|
var isArr = isArray$1(value),
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
742
|
+
isArg = !isArr && isArguments$1(value),
|
|
743
|
+
isBuff = !isArr && !isArg && isBuffer$1(value),
|
|
744
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
|
|
745
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
746
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
747
|
+
length = result.length;
|
|
748
|
+
|
|
700
749
|
for (var key in value) {
|
|
701
|
-
if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (
|
|
702
|
-
key == 'length' ||
|
|
703
|
-
isBuff && (key == 'offset' || key == 'parent') ||
|
|
704
|
-
isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
|
|
705
|
-
isIndex(key, length)))) {
|
|
750
|
+
if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == 'length' || isBuff && (key == 'offset' || key == 'parent') || isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || isIndex(key, length)))) {
|
|
706
751
|
result.push(key);
|
|
707
752
|
}
|
|
708
753
|
}
|
|
754
|
+
|
|
709
755
|
return result;
|
|
710
756
|
}
|
|
711
757
|
|
|
@@ -717,21 +763,22 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
717
763
|
|
|
718
764
|
var nativeKeys = overArg(Object.keys, Object);
|
|
719
765
|
var nativeKeys$1 = nativeKeys;
|
|
720
|
-
|
|
721
766
|
var objectProto$5 = Object.prototype;
|
|
722
|
-
|
|
723
767
|
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
724
768
|
|
|
725
769
|
function baseKeys(object) {
|
|
726
770
|
if (!isPrototype(object)) {
|
|
727
771
|
return nativeKeys$1(object);
|
|
728
772
|
}
|
|
773
|
+
|
|
729
774
|
var result = [];
|
|
775
|
+
|
|
730
776
|
for (var key in Object(object)) {
|
|
731
777
|
if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
|
|
732
778
|
result.push(key);
|
|
733
779
|
}
|
|
734
780
|
}
|
|
781
|
+
|
|
735
782
|
return result;
|
|
736
783
|
}
|
|
737
784
|
|
|
@@ -754,22 +801,21 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
754
801
|
}
|
|
755
802
|
|
|
756
803
|
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
757
|
-
|
|
758
804
|
var objectProto$4 = Object.prototype;
|
|
759
|
-
|
|
760
805
|
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
761
806
|
|
|
762
807
|
function hashGet(key) {
|
|
763
808
|
var data = this.__data__;
|
|
809
|
+
|
|
764
810
|
if (nativeCreate$1) {
|
|
765
811
|
var result = data[key];
|
|
766
812
|
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
767
813
|
}
|
|
814
|
+
|
|
768
815
|
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
|
|
769
816
|
}
|
|
770
817
|
|
|
771
818
|
var objectProto$3 = Object.prototype;
|
|
772
|
-
|
|
773
819
|
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
774
820
|
|
|
775
821
|
function hashHas(key) {
|
|
@@ -788,8 +834,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
788
834
|
|
|
789
835
|
function Hash(entries) {
|
|
790
836
|
var index = -1,
|
|
791
|
-
|
|
837
|
+
length = entries == null ? 0 : entries.length;
|
|
792
838
|
this.clear();
|
|
839
|
+
|
|
793
840
|
while (++index < length) {
|
|
794
841
|
var entry = entries[index];
|
|
795
842
|
this.set(entry[0], entry[1]);
|
|
@@ -809,37 +856,42 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
809
856
|
|
|
810
857
|
function assocIndexOf(array, key) {
|
|
811
858
|
var length = array.length;
|
|
859
|
+
|
|
812
860
|
while (length--) {
|
|
813
861
|
if (eq(array[length][0], key)) {
|
|
814
862
|
return length;
|
|
815
863
|
}
|
|
816
864
|
}
|
|
865
|
+
|
|
817
866
|
return -1;
|
|
818
867
|
}
|
|
819
868
|
|
|
820
869
|
var arrayProto = Array.prototype;
|
|
821
|
-
|
|
822
870
|
var splice = arrayProto.splice;
|
|
823
871
|
|
|
824
872
|
function listCacheDelete(key) {
|
|
825
873
|
var data = this.__data__,
|
|
826
|
-
|
|
874
|
+
index = assocIndexOf(data, key);
|
|
875
|
+
|
|
827
876
|
if (index < 0) {
|
|
828
877
|
return false;
|
|
829
878
|
}
|
|
879
|
+
|
|
830
880
|
var lastIndex = data.length - 1;
|
|
881
|
+
|
|
831
882
|
if (index == lastIndex) {
|
|
832
883
|
data.pop();
|
|
833
884
|
} else {
|
|
834
885
|
splice.call(data, index, 1);
|
|
835
886
|
}
|
|
887
|
+
|
|
836
888
|
--this.size;
|
|
837
889
|
return true;
|
|
838
890
|
}
|
|
839
891
|
|
|
840
892
|
function listCacheGet(key) {
|
|
841
893
|
var data = this.__data__,
|
|
842
|
-
|
|
894
|
+
index = assocIndexOf(data, key);
|
|
843
895
|
return index < 0 ? undefined : data[index][1];
|
|
844
896
|
}
|
|
845
897
|
|
|
@@ -849,20 +901,23 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
849
901
|
|
|
850
902
|
function listCacheSet(key, value) {
|
|
851
903
|
var data = this.__data__,
|
|
852
|
-
|
|
904
|
+
index = assocIndexOf(data, key);
|
|
905
|
+
|
|
853
906
|
if (index < 0) {
|
|
854
907
|
++this.size;
|
|
855
908
|
data.push([key, value]);
|
|
856
909
|
} else {
|
|
857
910
|
data[index][1] = value;
|
|
858
911
|
}
|
|
912
|
+
|
|
859
913
|
return this;
|
|
860
914
|
}
|
|
861
915
|
|
|
862
916
|
function ListCache(entries) {
|
|
863
917
|
var index = -1,
|
|
864
|
-
|
|
918
|
+
length = entries == null ? 0 : entries.length;
|
|
865
919
|
this.clear();
|
|
920
|
+
|
|
866
921
|
while (++index < length) {
|
|
867
922
|
var entry = entries[index];
|
|
868
923
|
this.set(entry[0], entry[1]);
|
|
@@ -874,7 +929,6 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
874
929
|
ListCache.prototype.get = listCacheGet;
|
|
875
930
|
ListCache.prototype.has = listCacheHas;
|
|
876
931
|
ListCache.prototype.set = listCacheSet;
|
|
877
|
-
|
|
878
932
|
var Map = getNative(root$1, 'Map');
|
|
879
933
|
var Map$1 = Map;
|
|
880
934
|
|
|
@@ -913,7 +967,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
913
967
|
|
|
914
968
|
function mapCacheSet(key, value) {
|
|
915
969
|
var data = getMapData(this, key),
|
|
916
|
-
|
|
970
|
+
size = data.size;
|
|
917
971
|
data.set(key, value);
|
|
918
972
|
this.size += data.size == size ? 0 : 1;
|
|
919
973
|
return this;
|
|
@@ -921,8 +975,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
921
975
|
|
|
922
976
|
function MapCache(entries) {
|
|
923
977
|
var index = -1,
|
|
924
|
-
|
|
978
|
+
length = entries == null ? 0 : entries.length;
|
|
925
979
|
this.clear();
|
|
980
|
+
|
|
926
981
|
while (++index < length) {
|
|
927
982
|
var entry = entries[index];
|
|
928
983
|
this.set(entry[0], entry[1]);
|
|
@@ -937,11 +992,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
937
992
|
|
|
938
993
|
function arrayPush(array, values) {
|
|
939
994
|
var index = -1,
|
|
940
|
-
|
|
941
|
-
|
|
995
|
+
length = values.length,
|
|
996
|
+
offset = array.length;
|
|
997
|
+
|
|
942
998
|
while (++index < length) {
|
|
943
999
|
array[offset + index] = values[index];
|
|
944
1000
|
}
|
|
1001
|
+
|
|
945
1002
|
return array;
|
|
946
1003
|
}
|
|
947
1004
|
|
|
@@ -952,7 +1009,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
952
1009
|
|
|
953
1010
|
function stackDelete(key) {
|
|
954
1011
|
var data = this.__data__,
|
|
955
|
-
|
|
1012
|
+
result = data['delete'](key);
|
|
956
1013
|
this.size = data.size;
|
|
957
1014
|
return result;
|
|
958
1015
|
}
|
|
@@ -969,15 +1026,19 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
969
1026
|
|
|
970
1027
|
function stackSet(key, value) {
|
|
971
1028
|
var data = this.__data__;
|
|
1029
|
+
|
|
972
1030
|
if (data instanceof ListCache) {
|
|
973
1031
|
var pairs = data.__data__;
|
|
1032
|
+
|
|
974
1033
|
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
975
1034
|
pairs.push([key, value]);
|
|
976
1035
|
this.size = ++data.size;
|
|
977
1036
|
return this;
|
|
978
1037
|
}
|
|
1038
|
+
|
|
979
1039
|
data = this.__data__ = new MapCache(pairs);
|
|
980
1040
|
}
|
|
1041
|
+
|
|
981
1042
|
data.set(key, value);
|
|
982
1043
|
this.size = data.size;
|
|
983
1044
|
return this;
|
|
@@ -996,15 +1057,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
996
1057
|
|
|
997
1058
|
function arrayFilter(array, predicate) {
|
|
998
1059
|
var index = -1,
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1060
|
+
length = array == null ? 0 : array.length,
|
|
1061
|
+
resIndex = 0,
|
|
1062
|
+
result = [];
|
|
1063
|
+
|
|
1002
1064
|
while (++index < length) {
|
|
1003
1065
|
var value = array[index];
|
|
1066
|
+
|
|
1004
1067
|
if (predicate(value, index, array)) {
|
|
1005
1068
|
result[resIndex++] = value;
|
|
1006
1069
|
}
|
|
1007
1070
|
}
|
|
1071
|
+
|
|
1008
1072
|
return result;
|
|
1009
1073
|
}
|
|
1010
1074
|
|
|
@@ -1013,15 +1077,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1013
1077
|
}
|
|
1014
1078
|
|
|
1015
1079
|
var objectProto$2 = Object.prototype;
|
|
1016
|
-
|
|
1017
1080
|
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
1018
|
-
|
|
1019
1081
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1020
|
-
|
|
1021
1082
|
var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
|
|
1022
1083
|
if (object == null) {
|
|
1023
1084
|
return [];
|
|
1024
1085
|
}
|
|
1086
|
+
|
|
1025
1087
|
object = Object(object);
|
|
1026
1088
|
return arrayFilter(nativeGetSymbols(object), function (symbol) {
|
|
1027
1089
|
return propertyIsEnumerable.call(object, symbol);
|
|
@@ -1040,59 +1102,60 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1040
1102
|
|
|
1041
1103
|
var DataView = getNative(root$1, 'DataView');
|
|
1042
1104
|
var DataView$1 = DataView;
|
|
1043
|
-
|
|
1044
1105
|
var Promise$1 = getNative(root$1, 'Promise');
|
|
1045
1106
|
var Promise$2 = Promise$1;
|
|
1046
|
-
|
|
1047
1107
|
var Set$1 = getNative(root$1, 'Set');
|
|
1048
1108
|
var Set$2 = Set$1;
|
|
1049
|
-
|
|
1050
1109
|
var mapTag$1 = '[object Map]',
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1110
|
+
objectTag$1 = '[object Object]',
|
|
1111
|
+
promiseTag = '[object Promise]',
|
|
1112
|
+
setTag$1 = '[object Set]',
|
|
1113
|
+
weakMapTag = '[object WeakMap]';
|
|
1055
1114
|
var dataViewTag$1 = '[object DataView]';
|
|
1056
|
-
|
|
1057
1115
|
var dataViewCtorString = toSource(DataView$1),
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1116
|
+
mapCtorString = toSource(Map$1),
|
|
1117
|
+
promiseCtorString = toSource(Promise$2),
|
|
1118
|
+
setCtorString = toSource(Set$2),
|
|
1119
|
+
weakMapCtorString = toSource(WeakMap$1);
|
|
1063
1120
|
var getTag = baseGetTag;
|
|
1064
1121
|
|
|
1065
1122
|
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$1 || Map$1 && getTag(new Map$1()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
|
|
1066
1123
|
getTag = function getTag(value) {
|
|
1067
1124
|
var result = baseGetTag(value),
|
|
1068
|
-
|
|
1069
|
-
|
|
1125
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
1126
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1127
|
+
|
|
1070
1128
|
if (ctorString) {
|
|
1071
1129
|
switch (ctorString) {
|
|
1072
1130
|
case dataViewCtorString:
|
|
1073
1131
|
return dataViewTag$1;
|
|
1132
|
+
|
|
1074
1133
|
case mapCtorString:
|
|
1075
1134
|
return mapTag$1;
|
|
1135
|
+
|
|
1076
1136
|
case promiseCtorString:
|
|
1077
1137
|
return promiseTag;
|
|
1138
|
+
|
|
1078
1139
|
case setCtorString:
|
|
1079
1140
|
return setTag$1;
|
|
1141
|
+
|
|
1080
1142
|
case weakMapCtorString:
|
|
1081
1143
|
return weakMapTag;
|
|
1082
1144
|
}
|
|
1083
1145
|
}
|
|
1146
|
+
|
|
1084
1147
|
return result;
|
|
1085
1148
|
};
|
|
1086
1149
|
}
|
|
1087
|
-
var getTag$1 = getTag;
|
|
1088
1150
|
|
|
1151
|
+
var getTag$1 = getTag;
|
|
1089
1152
|
var Uint8Array = root$1.Uint8Array;
|
|
1090
1153
|
var Uint8Array$1 = Uint8Array;
|
|
1091
|
-
|
|
1092
1154
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1093
1155
|
|
|
1094
1156
|
function setCacheAdd(value) {
|
|
1095
1157
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
1158
|
+
|
|
1096
1159
|
return this;
|
|
1097
1160
|
}
|
|
1098
1161
|
|
|
@@ -1102,8 +1165,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1102
1165
|
|
|
1103
1166
|
function SetCache(values) {
|
|
1104
1167
|
var index = -1,
|
|
1105
|
-
|
|
1168
|
+
length = values == null ? 0 : values.length;
|
|
1106
1169
|
this.__data__ = new MapCache();
|
|
1170
|
+
|
|
1107
1171
|
while (++index < length) {
|
|
1108
1172
|
this.add(values[index]);
|
|
1109
1173
|
}
|
|
@@ -1114,12 +1178,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1114
1178
|
|
|
1115
1179
|
function arraySome(array, predicate) {
|
|
1116
1180
|
var index = -1,
|
|
1117
|
-
|
|
1181
|
+
length = array == null ? 0 : array.length;
|
|
1182
|
+
|
|
1118
1183
|
while (++index < length) {
|
|
1119
1184
|
if (predicate(array[index], index, array)) {
|
|
1120
1185
|
return true;
|
|
1121
1186
|
}
|
|
1122
1187
|
}
|
|
1188
|
+
|
|
1123
1189
|
return false;
|
|
1124
1190
|
}
|
|
1125
1191
|
|
|
@@ -1128,39 +1194,47 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1128
1194
|
}
|
|
1129
1195
|
|
|
1130
1196
|
var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
1131
|
-
|
|
1197
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
1132
1198
|
|
|
1133
1199
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1134
1200
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
1135
|
-
|
|
1136
|
-
|
|
1201
|
+
arrLength = array.length,
|
|
1202
|
+
othLength = other.length;
|
|
1203
|
+
|
|
1137
1204
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1138
1205
|
return false;
|
|
1139
1206
|
}
|
|
1207
|
+
|
|
1140
1208
|
var arrStacked = stack.get(array);
|
|
1141
1209
|
var othStacked = stack.get(other);
|
|
1210
|
+
|
|
1142
1211
|
if (arrStacked && othStacked) {
|
|
1143
1212
|
return arrStacked == other && othStacked == array;
|
|
1144
1213
|
}
|
|
1214
|
+
|
|
1145
1215
|
var index = -1,
|
|
1146
|
-
|
|
1147
|
-
|
|
1216
|
+
result = true,
|
|
1217
|
+
seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : undefined;
|
|
1148
1218
|
stack.set(array, other);
|
|
1149
1219
|
stack.set(other, array);
|
|
1150
1220
|
|
|
1151
1221
|
while (++index < arrLength) {
|
|
1152
1222
|
var arrValue = array[index],
|
|
1153
|
-
|
|
1223
|
+
othValue = other[index];
|
|
1224
|
+
|
|
1154
1225
|
if (customizer) {
|
|
1155
1226
|
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
1156
1227
|
}
|
|
1228
|
+
|
|
1157
1229
|
if (compared !== undefined) {
|
|
1158
1230
|
if (compared) {
|
|
1159
1231
|
continue;
|
|
1160
1232
|
}
|
|
1233
|
+
|
|
1161
1234
|
result = false;
|
|
1162
1235
|
break;
|
|
1163
1236
|
}
|
|
1237
|
+
|
|
1164
1238
|
if (seen) {
|
|
1165
1239
|
if (!arraySome(other, function (othValue, othIndex) {
|
|
1166
1240
|
if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
@@ -1175,6 +1249,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1175
1249
|
break;
|
|
1176
1250
|
}
|
|
1177
1251
|
}
|
|
1252
|
+
|
|
1178
1253
|
stack['delete'](array);
|
|
1179
1254
|
stack['delete'](other);
|
|
1180
1255
|
return result;
|
|
@@ -1182,7 +1257,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1182
1257
|
|
|
1183
1258
|
function mapToArray(map) {
|
|
1184
1259
|
var index = -1,
|
|
1185
|
-
|
|
1260
|
+
result = Array(map.size);
|
|
1186
1261
|
map.forEach(function (value, key) {
|
|
1187
1262
|
result[++index] = [key, value];
|
|
1188
1263
|
});
|
|
@@ -1191,7 +1266,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1191
1266
|
|
|
1192
1267
|
function setToArray(set) {
|
|
1193
1268
|
var index = -1,
|
|
1194
|
-
|
|
1269
|
+
result = Array(set.size);
|
|
1195
1270
|
set.forEach(function (value) {
|
|
1196
1271
|
result[++index] = value;
|
|
1197
1272
|
});
|
|
@@ -1199,22 +1274,20 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1199
1274
|
}
|
|
1200
1275
|
|
|
1201
1276
|
var COMPARE_PARTIAL_FLAG$2 = 1,
|
|
1202
|
-
|
|
1203
|
-
|
|
1277
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
1204
1278
|
var boolTag = '[object Boolean]',
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1279
|
+
dateTag = '[object Date]',
|
|
1280
|
+
errorTag = '[object Error]',
|
|
1281
|
+
mapTag = '[object Map]',
|
|
1282
|
+
numberTag = '[object Number]',
|
|
1283
|
+
regexpTag = '[object RegExp]',
|
|
1284
|
+
setTag = '[object Set]',
|
|
1285
|
+
stringTag = '[object String]',
|
|
1286
|
+
symbolTag = '[object Symbol]';
|
|
1213
1287
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
1214
|
-
|
|
1215
|
-
|
|
1288
|
+
dataViewTag = '[object DataView]';
|
|
1216
1289
|
var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
|
|
1217
|
-
|
|
1290
|
+
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
1218
1291
|
|
|
1219
1292
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1220
1293
|
switch (tag) {
|
|
@@ -1222,149 +1295,178 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1222
1295
|
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
1223
1296
|
return false;
|
|
1224
1297
|
}
|
|
1298
|
+
|
|
1225
1299
|
object = object.buffer;
|
|
1226
1300
|
other = other.buffer;
|
|
1301
|
+
|
|
1227
1302
|
case arrayBufferTag:
|
|
1228
1303
|
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
|
|
1229
1304
|
return false;
|
|
1230
1305
|
}
|
|
1306
|
+
|
|
1231
1307
|
return true;
|
|
1308
|
+
|
|
1232
1309
|
case boolTag:
|
|
1233
1310
|
case dateTag:
|
|
1234
1311
|
case numberTag:
|
|
1235
1312
|
return eq(+object, +other);
|
|
1313
|
+
|
|
1236
1314
|
case errorTag:
|
|
1237
1315
|
return object.name == other.name && object.message == other.message;
|
|
1316
|
+
|
|
1238
1317
|
case regexpTag:
|
|
1239
1318
|
case stringTag:
|
|
1240
1319
|
return object == other + '';
|
|
1320
|
+
|
|
1241
1321
|
case mapTag:
|
|
1242
1322
|
var convert = mapToArray;
|
|
1323
|
+
|
|
1243
1324
|
case setTag:
|
|
1244
1325
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
1245
1326
|
convert || (convert = setToArray);
|
|
1327
|
+
|
|
1246
1328
|
if (object.size != other.size && !isPartial) {
|
|
1247
1329
|
return false;
|
|
1248
1330
|
}
|
|
1331
|
+
|
|
1249
1332
|
var stacked = stack.get(object);
|
|
1333
|
+
|
|
1250
1334
|
if (stacked) {
|
|
1251
1335
|
return stacked == other;
|
|
1252
1336
|
}
|
|
1253
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1254
1337
|
|
|
1338
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1255
1339
|
stack.set(object, other);
|
|
1256
1340
|
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1257
1341
|
stack['delete'](object);
|
|
1258
1342
|
return result;
|
|
1343
|
+
|
|
1259
1344
|
case symbolTag:
|
|
1260
1345
|
if (symbolValueOf) {
|
|
1261
1346
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1262
1347
|
}
|
|
1348
|
+
|
|
1263
1349
|
}
|
|
1350
|
+
|
|
1264
1351
|
return false;
|
|
1265
1352
|
}
|
|
1266
1353
|
|
|
1267
1354
|
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
1268
|
-
|
|
1269
1355
|
var objectProto$1 = Object.prototype;
|
|
1270
|
-
|
|
1271
1356
|
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
1272
1357
|
|
|
1273
1358
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1274
1359
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1360
|
+
objProps = getAllKeys(object),
|
|
1361
|
+
objLength = objProps.length,
|
|
1362
|
+
othProps = getAllKeys(other),
|
|
1363
|
+
othLength = othProps.length;
|
|
1364
|
+
|
|
1279
1365
|
if (objLength != othLength && !isPartial) {
|
|
1280
1366
|
return false;
|
|
1281
1367
|
}
|
|
1368
|
+
|
|
1282
1369
|
var index = objLength;
|
|
1370
|
+
|
|
1283
1371
|
while (index--) {
|
|
1284
1372
|
var key = objProps[index];
|
|
1373
|
+
|
|
1285
1374
|
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
1286
1375
|
return false;
|
|
1287
1376
|
}
|
|
1288
1377
|
}
|
|
1378
|
+
|
|
1289
1379
|
var objStacked = stack.get(object);
|
|
1290
1380
|
var othStacked = stack.get(other);
|
|
1381
|
+
|
|
1291
1382
|
if (objStacked && othStacked) {
|
|
1292
1383
|
return objStacked == other && othStacked == object;
|
|
1293
1384
|
}
|
|
1385
|
+
|
|
1294
1386
|
var result = true;
|
|
1295
1387
|
stack.set(object, other);
|
|
1296
1388
|
stack.set(other, object);
|
|
1297
1389
|
var skipCtor = isPartial;
|
|
1390
|
+
|
|
1298
1391
|
while (++index < objLength) {
|
|
1299
1392
|
key = objProps[index];
|
|
1300
1393
|
var objValue = object[key],
|
|
1301
|
-
|
|
1394
|
+
othValue = other[key];
|
|
1395
|
+
|
|
1302
1396
|
if (customizer) {
|
|
1303
1397
|
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
1304
1398
|
}
|
|
1399
|
+
|
|
1305
1400
|
if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
1306
1401
|
result = false;
|
|
1307
1402
|
break;
|
|
1308
1403
|
}
|
|
1404
|
+
|
|
1309
1405
|
skipCtor || (skipCtor = key == 'constructor');
|
|
1310
1406
|
}
|
|
1407
|
+
|
|
1311
1408
|
if (result && !skipCtor) {
|
|
1312
1409
|
var objCtor = object.constructor,
|
|
1313
|
-
|
|
1410
|
+
othCtor = other.constructor;
|
|
1314
1411
|
|
|
1315
1412
|
if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
1316
1413
|
result = false;
|
|
1317
1414
|
}
|
|
1318
1415
|
}
|
|
1416
|
+
|
|
1319
1417
|
stack['delete'](object);
|
|
1320
1418
|
stack['delete'](other);
|
|
1321
1419
|
return result;
|
|
1322
1420
|
}
|
|
1323
1421
|
|
|
1324
1422
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
1325
|
-
|
|
1326
1423
|
var argsTag = '[object Arguments]',
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1424
|
+
arrayTag = '[object Array]',
|
|
1425
|
+
objectTag = '[object Object]';
|
|
1330
1426
|
var objectProto = Object.prototype;
|
|
1331
|
-
|
|
1332
1427
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1333
1428
|
|
|
1334
1429
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1335
1430
|
var objIsArr = isArray$1(object),
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1431
|
+
othIsArr = isArray$1(other),
|
|
1432
|
+
objTag = objIsArr ? arrayTag : getTag$1(object),
|
|
1433
|
+
othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
1339
1434
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1340
1435
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1341
1436
|
var objIsObj = objTag == objectTag,
|
|
1342
|
-
|
|
1343
|
-
|
|
1437
|
+
othIsObj = othTag == objectTag,
|
|
1438
|
+
isSameTag = objTag == othTag;
|
|
1439
|
+
|
|
1344
1440
|
if (isSameTag && isBuffer$1(object)) {
|
|
1345
1441
|
if (!isBuffer$1(other)) {
|
|
1346
1442
|
return false;
|
|
1347
1443
|
}
|
|
1444
|
+
|
|
1348
1445
|
objIsArr = true;
|
|
1349
1446
|
objIsObj = false;
|
|
1350
1447
|
}
|
|
1448
|
+
|
|
1351
1449
|
if (isSameTag && !objIsObj) {
|
|
1352
1450
|
stack || (stack = new Stack());
|
|
1353
1451
|
return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1354
1452
|
}
|
|
1453
|
+
|
|
1355
1454
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
1356
1455
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
1357
|
-
|
|
1456
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
1457
|
+
|
|
1358
1458
|
if (objIsWrapped || othIsWrapped) {
|
|
1359
1459
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
1360
|
-
|
|
1460
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1361
1461
|
stack || (stack = new Stack());
|
|
1362
1462
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1363
1463
|
}
|
|
1364
1464
|
}
|
|
1465
|
+
|
|
1365
1466
|
if (!isSameTag) {
|
|
1366
1467
|
return false;
|
|
1367
1468
|
}
|
|
1469
|
+
|
|
1368
1470
|
stack || (stack = new Stack());
|
|
1369
1471
|
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1370
1472
|
}
|
|
@@ -1373,57 +1475,71 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1373
1475
|
if (value === other) {
|
|
1374
1476
|
return true;
|
|
1375
1477
|
}
|
|
1478
|
+
|
|
1376
1479
|
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
1377
1480
|
return value !== value && other !== other;
|
|
1378
1481
|
}
|
|
1482
|
+
|
|
1379
1483
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1380
1484
|
}
|
|
1381
1485
|
|
|
1382
1486
|
function isEqual(value, other) {
|
|
1383
1487
|
return baseIsEqual(value, other);
|
|
1384
1488
|
}
|
|
1489
|
+
|
|
1385
1490
|
exports.OBSERVER_TYPE = void 0;
|
|
1491
|
+
|
|
1386
1492
|
(function (ObserverType) {
|
|
1387
1493
|
ObserverType["ADD"] = "ADD";
|
|
1388
1494
|
ObserverType["REMOVE"] = "REMOVE";
|
|
1389
1495
|
ObserverType["CHANGE"] = "CHANGE";
|
|
1390
1496
|
})(exports.OBSERVER_TYPE || (exports.OBSERVER_TYPE = {}));
|
|
1497
|
+
|
|
1391
1498
|
var objectCache = {};
|
|
1392
1499
|
var systemInstance = {};
|
|
1393
1500
|
var observerInfos = {};
|
|
1394
1501
|
var componentProps = {};
|
|
1502
|
+
|
|
1395
1503
|
function getObjectCache(component, keys) {
|
|
1396
1504
|
if (!objectCache[component.gameObject.id]) {
|
|
1397
1505
|
objectCache[component.gameObject.id] = {};
|
|
1398
1506
|
}
|
|
1507
|
+
|
|
1399
1508
|
var cache = objectCache[component.gameObject.id];
|
|
1400
1509
|
var key = component.name + '_' + keys.join(',');
|
|
1510
|
+
|
|
1401
1511
|
if (cache[key]) {
|
|
1402
1512
|
return cache[key];
|
|
1403
1513
|
}
|
|
1514
|
+
|
|
1404
1515
|
var keyIndex = keys.length - 1;
|
|
1405
1516
|
var property = component;
|
|
1517
|
+
|
|
1406
1518
|
for (var i = 0; i < keyIndex; i++) {
|
|
1407
1519
|
property = property[keys[i]];
|
|
1408
1520
|
}
|
|
1521
|
+
|
|
1409
1522
|
cache[key] = {
|
|
1410
1523
|
property: property,
|
|
1411
1524
|
key: keys[keyIndex]
|
|
1412
1525
|
};
|
|
1413
1526
|
return cache[key];
|
|
1414
1527
|
}
|
|
1528
|
+
|
|
1415
1529
|
function removeObjectCache(component) {
|
|
1416
1530
|
if (component.gameObject) {
|
|
1417
1531
|
delete objectCache[component.gameObject.id];
|
|
1418
1532
|
}
|
|
1419
1533
|
}
|
|
1534
|
+
|
|
1420
1535
|
function addObserver(_a) {
|
|
1421
1536
|
var _b, _c;
|
|
1537
|
+
|
|
1422
1538
|
var systemName = _a.systemName,
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1539
|
+
componentName = _a.componentName,
|
|
1540
|
+
component = _a.component,
|
|
1541
|
+
prop = _a.prop,
|
|
1542
|
+
type = _a.type;
|
|
1427
1543
|
(_c = (_b = systemInstance[systemName]) === null || _b === void 0 ? void 0 : _b.componentObserver) === null || _c === void 0 ? void 0 : _c.add({
|
|
1428
1544
|
component: component,
|
|
1429
1545
|
prop: prop,
|
|
@@ -1431,10 +1547,12 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1431
1547
|
componentName: componentName
|
|
1432
1548
|
});
|
|
1433
1549
|
}
|
|
1550
|
+
|
|
1434
1551
|
function pushToQueue(_a) {
|
|
1435
1552
|
var prop = _a.prop,
|
|
1436
|
-
|
|
1437
|
-
|
|
1553
|
+
component = _a.component,
|
|
1554
|
+
componentName = _a.componentName;
|
|
1555
|
+
|
|
1438
1556
|
for (var systemName in observerInfos) {
|
|
1439
1557
|
var observerInfo = observerInfos[systemName] || {};
|
|
1440
1558
|
var info = observerInfo[componentName];
|
|
@@ -1442,6 +1560,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1442
1560
|
var index = info.findIndex(function (p) {
|
|
1443
1561
|
return isEqual(p, prop);
|
|
1444
1562
|
});
|
|
1563
|
+
|
|
1445
1564
|
if (index > -1) {
|
|
1446
1565
|
addObserver({
|
|
1447
1566
|
systemName: systemName,
|
|
@@ -1453,25 +1572,31 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1453
1572
|
}
|
|
1454
1573
|
}
|
|
1455
1574
|
}
|
|
1575
|
+
|
|
1456
1576
|
function defineProperty(_a) {
|
|
1457
1577
|
var e_1, _b;
|
|
1578
|
+
|
|
1458
1579
|
var obj = _a.obj,
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1580
|
+
key = _a.key,
|
|
1581
|
+
prop = _a.prop,
|
|
1582
|
+
component = _a.component,
|
|
1583
|
+
componentName = _a.componentName;
|
|
1584
|
+
|
|
1463
1585
|
if (obj === undefined) {
|
|
1464
1586
|
return;
|
|
1465
1587
|
}
|
|
1588
|
+
|
|
1466
1589
|
if (!(key in obj)) {
|
|
1467
1590
|
console.error("prop " + key + " not in component: " + componentName + ", Can not observer");
|
|
1468
1591
|
return;
|
|
1469
1592
|
}
|
|
1593
|
+
|
|
1470
1594
|
Object.defineProperty(obj, "_" + key, {
|
|
1471
1595
|
enumerable: false,
|
|
1472
1596
|
writable: true,
|
|
1473
1597
|
value: obj[key]
|
|
1474
1598
|
});
|
|
1599
|
+
|
|
1475
1600
|
if (prop.deep && isObject(obj[key])) {
|
|
1476
1601
|
try {
|
|
1477
1602
|
for (var _c = __values(Object.keys(obj[key])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1496,6 +1621,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1496
1621
|
}
|
|
1497
1622
|
}
|
|
1498
1623
|
}
|
|
1624
|
+
|
|
1499
1625
|
Object.defineProperty(obj, key, {
|
|
1500
1626
|
enumerable: true,
|
|
1501
1627
|
set: function set(val) {
|
|
@@ -1512,34 +1638,44 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1512
1638
|
}
|
|
1513
1639
|
});
|
|
1514
1640
|
}
|
|
1641
|
+
|
|
1515
1642
|
function isComponent(comp) {
|
|
1516
1643
|
return comp && comp.constructor && 'componentName' in comp.constructor;
|
|
1517
1644
|
}
|
|
1645
|
+
|
|
1518
1646
|
function initObserver(Systems) {
|
|
1519
1647
|
var e_2, _a, e_3, _b;
|
|
1648
|
+
|
|
1520
1649
|
var Ss = [];
|
|
1650
|
+
|
|
1521
1651
|
if (Systems instanceof Array) {
|
|
1522
1652
|
Ss.push.apply(Ss, __spread(Systems));
|
|
1523
1653
|
} else {
|
|
1524
1654
|
Ss.push(Systems);
|
|
1525
1655
|
}
|
|
1656
|
+
|
|
1526
1657
|
try {
|
|
1527
1658
|
for (var Ss_1 = __values(Ss), Ss_1_1 = Ss_1.next(); !Ss_1_1.done; Ss_1_1 = Ss_1.next()) {
|
|
1528
1659
|
var S = Ss_1_1.value;
|
|
1660
|
+
|
|
1529
1661
|
for (var componentName in S.observerInfo) {
|
|
1530
1662
|
componentProps[componentName] = componentProps[componentName] || [];
|
|
1531
1663
|
var props = componentProps[componentName];
|
|
1664
|
+
|
|
1532
1665
|
var _loop_1 = function _loop_1(prop) {
|
|
1533
1666
|
var index = props.findIndex(function (p) {
|
|
1534
1667
|
return isEqual(p, prop);
|
|
1535
1668
|
});
|
|
1669
|
+
|
|
1536
1670
|
if (index === -1) {
|
|
1537
1671
|
componentProps[componentName].push(prop);
|
|
1538
1672
|
}
|
|
1539
1673
|
};
|
|
1674
|
+
|
|
1540
1675
|
try {
|
|
1541
1676
|
for (var _c = (e_3 = void 0, __values(S.observerInfo[componentName])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1542
1677
|
var prop = _d.value;
|
|
1678
|
+
|
|
1543
1679
|
_loop_1(prop);
|
|
1544
1680
|
}
|
|
1545
1681
|
} catch (e_3_1) {
|
|
@@ -1567,26 +1703,34 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1567
1703
|
}
|
|
1568
1704
|
}
|
|
1569
1705
|
}
|
|
1706
|
+
|
|
1570
1707
|
function observer(component, componentName) {
|
|
1571
1708
|
var e_4, _a;
|
|
1709
|
+
|
|
1572
1710
|
if (componentName === void 0) {
|
|
1573
1711
|
componentName = component.name;
|
|
1574
1712
|
}
|
|
1713
|
+
|
|
1575
1714
|
if (!componentName || !componentProps[componentName]) {
|
|
1576
1715
|
return;
|
|
1577
1716
|
}
|
|
1717
|
+
|
|
1578
1718
|
if (!component || !isComponent(component)) {
|
|
1579
1719
|
throw new Error('component param must be an instance of Component');
|
|
1580
1720
|
}
|
|
1721
|
+
|
|
1581
1722
|
if (!component.gameObject || !component.gameObject.id) {
|
|
1582
1723
|
throw new Error('component should be add to a gameObject');
|
|
1583
1724
|
}
|
|
1725
|
+
|
|
1584
1726
|
try {
|
|
1585
1727
|
for (var _b = __values(componentProps[componentName]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1586
1728
|
var item = _c.value;
|
|
1729
|
+
|
|
1587
1730
|
var _d = getObjectCache(component, item.prop),
|
|
1588
|
-
|
|
1589
|
-
|
|
1731
|
+
property = _d.property,
|
|
1732
|
+
key = _d.key;
|
|
1733
|
+
|
|
1590
1734
|
defineProperty({
|
|
1591
1735
|
obj: property,
|
|
1592
1736
|
key: key,
|
|
@@ -1607,14 +1751,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1607
1751
|
}
|
|
1608
1752
|
}
|
|
1609
1753
|
}
|
|
1754
|
+
|
|
1610
1755
|
function observerAdded(component, componentName) {
|
|
1611
1756
|
var _a, _b;
|
|
1757
|
+
|
|
1612
1758
|
if (componentName === void 0) {
|
|
1613
1759
|
componentName = component.name;
|
|
1614
1760
|
}
|
|
1761
|
+
|
|
1615
1762
|
for (var systemName in observerInfos) {
|
|
1616
1763
|
var observerInfo = observerInfos[systemName] || {};
|
|
1617
1764
|
var info = observerInfo[componentName];
|
|
1765
|
+
|
|
1618
1766
|
if (info) {
|
|
1619
1767
|
(_b = (_a = systemInstance[systemName]) === null || _a === void 0 ? void 0 : _a.componentObserver) === null || _b === void 0 ? void 0 : _b.add({
|
|
1620
1768
|
component: component,
|
|
@@ -1624,14 +1772,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1624
1772
|
}
|
|
1625
1773
|
}
|
|
1626
1774
|
}
|
|
1775
|
+
|
|
1627
1776
|
function observerRemoved(component, componentName) {
|
|
1628
1777
|
var _a, _b;
|
|
1778
|
+
|
|
1629
1779
|
if (componentName === void 0) {
|
|
1630
1780
|
componentName = component.name;
|
|
1631
1781
|
}
|
|
1782
|
+
|
|
1632
1783
|
for (var systemName in observerInfos) {
|
|
1633
1784
|
var observerInfo = observerInfos[systemName] || {};
|
|
1634
1785
|
var info = observerInfo[componentName];
|
|
1786
|
+
|
|
1635
1787
|
if (info) {
|
|
1636
1788
|
(_b = (_a = systemInstance[systemName]) === null || _a === void 0 ? void 0 : _a.componentObserver) === null || _b === void 0 ? void 0 : _b.add({
|
|
1637
1789
|
component: component,
|
|
@@ -1640,22 +1792,28 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1640
1792
|
});
|
|
1641
1793
|
}
|
|
1642
1794
|
}
|
|
1795
|
+
|
|
1643
1796
|
removeObjectCache(component);
|
|
1644
1797
|
}
|
|
1798
|
+
|
|
1645
1799
|
function setSystemObserver(system, S) {
|
|
1646
1800
|
observerInfos[S.systemName] = S.observerInfo;
|
|
1647
1801
|
systemInstance[S.systemName] = system;
|
|
1648
1802
|
}
|
|
1803
|
+
|
|
1649
1804
|
function getIDEPropsPropertyObj(target, propertyKey) {
|
|
1650
1805
|
if (!target.constructor.IDEProps) {
|
|
1651
1806
|
target.constructor.IDEProps = {};
|
|
1652
1807
|
}
|
|
1808
|
+
|
|
1653
1809
|
if (!target.constructor.IDEProps[propertyKey]) {
|
|
1654
1810
|
target.constructor.IDEProps[propertyKey] = {};
|
|
1655
1811
|
}
|
|
1812
|
+
|
|
1656
1813
|
var propertyObj = target.constructor.IDEProps[propertyKey];
|
|
1657
1814
|
return propertyObj;
|
|
1658
1815
|
}
|
|
1816
|
+
|
|
1659
1817
|
function type(type) {
|
|
1660
1818
|
return function (target, propertyKey) {
|
|
1661
1819
|
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
@@ -1663,16 +1821,20 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1663
1821
|
prop.type = type;
|
|
1664
1822
|
};
|
|
1665
1823
|
}
|
|
1824
|
+
|
|
1666
1825
|
function step(step) {
|
|
1667
1826
|
return function (target, propertyKey) {
|
|
1668
1827
|
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
1669
1828
|
prop.step = step;
|
|
1670
1829
|
};
|
|
1671
1830
|
}
|
|
1831
|
+
|
|
1672
1832
|
var Transform = function (_super) {
|
|
1673
1833
|
__extends$1(Transform, _super);
|
|
1834
|
+
|
|
1674
1835
|
function Transform() {
|
|
1675
1836
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1837
|
+
|
|
1676
1838
|
_this.name = 'Transform';
|
|
1677
1839
|
_this._parent = null;
|
|
1678
1840
|
_this.inScene = false;
|
|
@@ -1704,15 +1866,20 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1704
1866
|
_this.rotation = 0;
|
|
1705
1867
|
return _this;
|
|
1706
1868
|
}
|
|
1869
|
+
|
|
1707
1870
|
Transform.prototype.init = function (params) {
|
|
1708
1871
|
var e_1, _a;
|
|
1872
|
+
|
|
1709
1873
|
if (params === void 0) {
|
|
1710
1874
|
params = {};
|
|
1711
1875
|
}
|
|
1876
|
+
|
|
1712
1877
|
var props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew'];
|
|
1878
|
+
|
|
1713
1879
|
try {
|
|
1714
1880
|
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
|
|
1715
1881
|
var key = props_1_1.value;
|
|
1882
|
+
|
|
1716
1883
|
_extends(this[key], params[key]);
|
|
1717
1884
|
}
|
|
1718
1885
|
} catch (e_1_1) {
|
|
@@ -1726,8 +1893,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1726
1893
|
if (e_1) throw e_1.error;
|
|
1727
1894
|
}
|
|
1728
1895
|
}
|
|
1896
|
+
|
|
1729
1897
|
this.rotation = params.rotation || this.rotation;
|
|
1730
1898
|
};
|
|
1899
|
+
|
|
1731
1900
|
Object.defineProperty(Transform.prototype, "parent", {
|
|
1732
1901
|
get: function get() {
|
|
1733
1902
|
return this._parent;
|
|
@@ -1742,6 +1911,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1742
1911
|
enumerable: false,
|
|
1743
1912
|
configurable: true
|
|
1744
1913
|
});
|
|
1914
|
+
|
|
1745
1915
|
Transform.prototype.addChild = function (child) {
|
|
1746
1916
|
if (child.parent === this) {
|
|
1747
1917
|
var index = this.children.findIndex(function (item) {
|
|
@@ -1751,36 +1921,52 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1751
1921
|
} else if (child.parent) {
|
|
1752
1922
|
child.parent.removeChild(child);
|
|
1753
1923
|
}
|
|
1924
|
+
|
|
1754
1925
|
child._parent = this;
|
|
1755
1926
|
this.children.push(child);
|
|
1756
1927
|
};
|
|
1928
|
+
|
|
1757
1929
|
Transform.prototype.removeChild = function (child) {
|
|
1758
1930
|
var index = this.children.findIndex(function (item) {
|
|
1759
1931
|
return item === child;
|
|
1760
1932
|
});
|
|
1933
|
+
|
|
1761
1934
|
if (index > -1) {
|
|
1762
1935
|
this.children.splice(index, 1);
|
|
1763
1936
|
child._parent = null;
|
|
1764
1937
|
}
|
|
1765
1938
|
};
|
|
1939
|
+
|
|
1766
1940
|
Transform.prototype.clearChildren = function () {
|
|
1767
1941
|
this.children.length = 0;
|
|
1768
1942
|
};
|
|
1943
|
+
|
|
1769
1944
|
Transform.componentName = 'Transform';
|
|
1945
|
+
|
|
1770
1946
|
__decorate([type('vector2'), step(1)], Transform.prototype, "position", void 0);
|
|
1947
|
+
|
|
1771
1948
|
__decorate([type('size'), step(1)], Transform.prototype, "size", void 0);
|
|
1949
|
+
|
|
1772
1950
|
__decorate([type('vector2'), step(0.1)], Transform.prototype, "origin", void 0);
|
|
1951
|
+
|
|
1773
1952
|
__decorate([type('vector2'), step(0.1)], Transform.prototype, "anchor", void 0);
|
|
1953
|
+
|
|
1774
1954
|
__decorate([type('vector2'), step(0.1)], Transform.prototype, "scale", void 0);
|
|
1955
|
+
|
|
1775
1956
|
__decorate([type('vector2'), step(0.1)], Transform.prototype, "skew", void 0);
|
|
1957
|
+
|
|
1776
1958
|
__decorate([type('number'), step(0.1)], Transform.prototype, "rotation", void 0);
|
|
1959
|
+
|
|
1777
1960
|
return Transform;
|
|
1778
1961
|
}(Component$1);
|
|
1962
|
+
|
|
1779
1963
|
var Transform$1 = Transform;
|
|
1780
1964
|
var _id = 0;
|
|
1965
|
+
|
|
1781
1966
|
function getId() {
|
|
1782
1967
|
return ++_id;
|
|
1783
1968
|
}
|
|
1969
|
+
|
|
1784
1970
|
var GameObject = function () {
|
|
1785
1971
|
function GameObject(name, obj) {
|
|
1786
1972
|
this._componentCache = {};
|
|
@@ -1790,6 +1976,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1790
1976
|
this.id = getId();
|
|
1791
1977
|
this.addComponent(Transform$1, obj);
|
|
1792
1978
|
}
|
|
1979
|
+
|
|
1793
1980
|
Object.defineProperty(GameObject.prototype, "transform", {
|
|
1794
1981
|
get: function get() {
|
|
1795
1982
|
return this.getComponent(Transform$1);
|
|
@@ -1817,9 +2004,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1817
2004
|
},
|
|
1818
2005
|
set: function set(val) {
|
|
1819
2006
|
var e_1, _a;
|
|
2007
|
+
|
|
1820
2008
|
if (this._scene === val) return;
|
|
1821
2009
|
var scene = this._scene;
|
|
1822
2010
|
this._scene = val;
|
|
2011
|
+
|
|
1823
2012
|
if (this.transform && this.transform.children) {
|
|
1824
2013
|
try {
|
|
1825
2014
|
for (var _b = __values(this.transform.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1838,6 +2027,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1838
2027
|
}
|
|
1839
2028
|
}
|
|
1840
2029
|
}
|
|
2030
|
+
|
|
1841
2031
|
if (val) {
|
|
1842
2032
|
val.addGameObject(this);
|
|
1843
2033
|
} else {
|
|
@@ -1847,30 +2037,38 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1847
2037
|
enumerable: false,
|
|
1848
2038
|
configurable: true
|
|
1849
2039
|
});
|
|
2040
|
+
|
|
1850
2041
|
GameObject.prototype.addChild = function (gameObject) {
|
|
1851
2042
|
if (!gameObject || !gameObject.transform || gameObject === this) return;
|
|
2043
|
+
|
|
1852
2044
|
if (!(gameObject instanceof GameObject)) {
|
|
1853
2045
|
throw new Error('addChild only receive GameObject');
|
|
1854
2046
|
}
|
|
2047
|
+
|
|
1855
2048
|
if (!this.transform) {
|
|
1856
2049
|
throw new Error("gameObject '" + this.name + "' has been destroy");
|
|
1857
2050
|
}
|
|
2051
|
+
|
|
1858
2052
|
gameObject.transform.parent = this.transform;
|
|
1859
2053
|
gameObject.scene = this.scene;
|
|
1860
2054
|
};
|
|
2055
|
+
|
|
1861
2056
|
GameObject.prototype.removeChild = function (gameObject) {
|
|
1862
2057
|
if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) {
|
|
1863
2058
|
return gameObject;
|
|
1864
2059
|
}
|
|
2060
|
+
|
|
1865
2061
|
gameObject.transform.parent = null;
|
|
1866
2062
|
gameObject.scene = null;
|
|
1867
2063
|
return gameObject;
|
|
1868
2064
|
};
|
|
2065
|
+
|
|
1869
2066
|
GameObject.prototype.addComponent = function (C, obj) {
|
|
1870
2067
|
if (this.destroyed) return;
|
|
1871
2068
|
var componentName = getComponentName(C);
|
|
1872
2069
|
if (this._componentCache[componentName]) return;
|
|
1873
2070
|
var component;
|
|
2071
|
+
|
|
1874
2072
|
if (C instanceof Function) {
|
|
1875
2073
|
component = new C(obj);
|
|
1876
2074
|
} else if (C instanceof Component$1) {
|
|
@@ -1878,9 +2076,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1878
2076
|
} else {
|
|
1879
2077
|
throw new Error('addComponent recieve Component and Component Constructor');
|
|
1880
2078
|
}
|
|
2079
|
+
|
|
1881
2080
|
if (component.gameObject) {
|
|
1882
2081
|
throw new Error("component has been added on gameObject " + component.gameObject.name);
|
|
1883
2082
|
}
|
|
2083
|
+
|
|
1884
2084
|
component.gameObject = this;
|
|
1885
2085
|
component.init && component.init(component.__componentDefaultParams);
|
|
1886
2086
|
observerAdded(component, component.name);
|
|
@@ -1890,8 +2090,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1890
2090
|
component.awake && component.awake();
|
|
1891
2091
|
return component;
|
|
1892
2092
|
};
|
|
2093
|
+
|
|
1893
2094
|
GameObject.prototype.removeComponent = function (c) {
|
|
1894
2095
|
var componentName;
|
|
2096
|
+
|
|
1895
2097
|
if (typeof c === 'string') {
|
|
1896
2098
|
componentName = c;
|
|
1897
2099
|
} else if (c instanceof Component$1) {
|
|
@@ -1899,11 +2101,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1899
2101
|
} else if (c.componentName) {
|
|
1900
2102
|
componentName = c.componentName;
|
|
1901
2103
|
}
|
|
2104
|
+
|
|
1902
2105
|
if (componentName === 'Transform') {
|
|
1903
2106
|
throw new Error("Transform can't be removed");
|
|
1904
2107
|
}
|
|
2108
|
+
|
|
1905
2109
|
return this._removeComponent(componentName);
|
|
1906
2110
|
};
|
|
2111
|
+
|
|
1907
2112
|
GameObject.prototype._removeComponent = function (componentName) {
|
|
1908
2113
|
var index = this.components.findIndex(function (_a) {
|
|
1909
2114
|
var name = _a.name;
|
|
@@ -1918,8 +2123,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1918
2123
|
component.gameObject = undefined;
|
|
1919
2124
|
return component;
|
|
1920
2125
|
};
|
|
2126
|
+
|
|
1921
2127
|
GameObject.prototype.getComponent = function (c) {
|
|
1922
2128
|
var componentName;
|
|
2129
|
+
|
|
1923
2130
|
if (typeof c === 'string') {
|
|
1924
2131
|
componentName = c;
|
|
1925
2132
|
} else if (c instanceof Component$1) {
|
|
@@ -1927,44 +2134,55 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1927
2134
|
} else if (c.componentName) {
|
|
1928
2135
|
componentName = c.componentName;
|
|
1929
2136
|
}
|
|
2137
|
+
|
|
1930
2138
|
if (typeof this._componentCache[componentName] !== 'undefined') {
|
|
1931
2139
|
return this._componentCache[componentName];
|
|
1932
2140
|
} else {
|
|
1933
2141
|
return;
|
|
1934
2142
|
}
|
|
1935
2143
|
};
|
|
2144
|
+
|
|
1936
2145
|
GameObject.prototype.remove = function () {
|
|
1937
2146
|
if (this.parent) return this.parent.removeChild(this);
|
|
1938
2147
|
};
|
|
2148
|
+
|
|
1939
2149
|
GameObject.prototype.destroy = function () {
|
|
1940
2150
|
if (!this.transform) {
|
|
1941
2151
|
console.error('Cannot destroy gameObject that have already been destroyed.');
|
|
1942
2152
|
return;
|
|
1943
2153
|
}
|
|
2154
|
+
|
|
1944
2155
|
Array.from(this.transform.children).forEach(function (_a) {
|
|
1945
2156
|
var gameObject = _a.gameObject;
|
|
1946
2157
|
gameObject.destroy();
|
|
1947
2158
|
});
|
|
1948
2159
|
this.remove();
|
|
1949
2160
|
this.transform.clearChildren();
|
|
2161
|
+
|
|
1950
2162
|
for (var key in this._componentCache) {
|
|
1951
2163
|
this._removeComponent(key);
|
|
1952
2164
|
}
|
|
2165
|
+
|
|
1953
2166
|
this.components.length = 0;
|
|
1954
2167
|
this.destroyed = true;
|
|
1955
2168
|
};
|
|
2169
|
+
|
|
1956
2170
|
return GameObject;
|
|
1957
2171
|
}();
|
|
2172
|
+
|
|
1958
2173
|
var GameObject$1 = GameObject;
|
|
2174
|
+
|
|
1959
2175
|
var ComponentObserver = function () {
|
|
1960
2176
|
function ComponentObserver() {
|
|
1961
2177
|
this.events = [];
|
|
1962
2178
|
}
|
|
2179
|
+
|
|
1963
2180
|
ComponentObserver.prototype.add = function (_a) {
|
|
1964
2181
|
var component = _a.component,
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2182
|
+
prop = _a.prop,
|
|
2183
|
+
type = _a.type,
|
|
2184
|
+
componentName = _a.componentName;
|
|
2185
|
+
|
|
1968
2186
|
if (type === exports.OBSERVER_TYPE.REMOVE) {
|
|
1969
2187
|
if (this.events.find(function (changed) {
|
|
1970
2188
|
return changed.component === component && changed.type === exports.OBSERVER_TYPE.ADD;
|
|
@@ -1974,16 +2192,20 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1974
2192
|
});
|
|
1975
2193
|
return;
|
|
1976
2194
|
}
|
|
2195
|
+
|
|
1977
2196
|
this.events = this.events.filter(function (changed) {
|
|
1978
2197
|
return changed.component !== component;
|
|
1979
2198
|
});
|
|
1980
2199
|
}
|
|
2200
|
+
|
|
1981
2201
|
var index = this.events.findIndex(function (changed) {
|
|
1982
2202
|
return changed.component === component && isEqual(changed.prop, prop) && changed.type === type;
|
|
1983
2203
|
});
|
|
2204
|
+
|
|
1984
2205
|
if (index > -1) {
|
|
1985
2206
|
this.events.splice(index, 1);
|
|
1986
2207
|
}
|
|
2208
|
+
|
|
1987
2209
|
this.events.push({
|
|
1988
2210
|
gameObject: component.gameObject,
|
|
1989
2211
|
component: component,
|
|
@@ -1992,9 +2214,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
1992
2214
|
componentName: componentName
|
|
1993
2215
|
});
|
|
1994
2216
|
};
|
|
2217
|
+
|
|
1995
2218
|
ComponentObserver.prototype.getChanged = function () {
|
|
1996
2219
|
return this.events;
|
|
1997
2220
|
};
|
|
2221
|
+
|
|
1998
2222
|
Object.defineProperty(ComponentObserver.prototype, "changed", {
|
|
1999
2223
|
get: function get() {
|
|
2000
2224
|
return this.events;
|
|
@@ -2002,14 +2226,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2002
2226
|
enumerable: false,
|
|
2003
2227
|
configurable: true
|
|
2004
2228
|
});
|
|
2229
|
+
|
|
2005
2230
|
ComponentObserver.prototype.clear = function () {
|
|
2006
2231
|
var events = this.events;
|
|
2007
2232
|
this.events = [];
|
|
2008
2233
|
return events;
|
|
2009
2234
|
};
|
|
2235
|
+
|
|
2010
2236
|
return ComponentObserver;
|
|
2011
2237
|
}();
|
|
2238
|
+
|
|
2012
2239
|
var ComponentObserver$1 = ComponentObserver;
|
|
2240
|
+
|
|
2013
2241
|
var System = function () {
|
|
2014
2242
|
function System(params) {
|
|
2015
2243
|
this.started = false;
|
|
@@ -2017,17 +2245,23 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2017
2245
|
this.__systemDefaultParams = params;
|
|
2018
2246
|
this.name = this.constructor.systemName;
|
|
2019
2247
|
}
|
|
2248
|
+
|
|
2020
2249
|
System.prototype.destroy = function () {
|
|
2021
2250
|
var _a;
|
|
2251
|
+
|
|
2022
2252
|
this.componentObserver = null;
|
|
2023
2253
|
this.__systemDefaultParams = null;
|
|
2024
2254
|
(_a = this.onDestroy) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2025
2255
|
};
|
|
2256
|
+
|
|
2026
2257
|
return System;
|
|
2027
2258
|
}();
|
|
2259
|
+
|
|
2028
2260
|
var System$1 = System;
|
|
2261
|
+
|
|
2029
2262
|
function createNowTime() {
|
|
2030
2263
|
var nowtime = null;
|
|
2264
|
+
|
|
2031
2265
|
if (Date.now) {
|
|
2032
2266
|
nowtime = Date.now;
|
|
2033
2267
|
} else {
|
|
@@ -2035,23 +2269,30 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2035
2269
|
return new Date().getTime();
|
|
2036
2270
|
};
|
|
2037
2271
|
}
|
|
2272
|
+
|
|
2038
2273
|
return nowtime;
|
|
2039
2274
|
}
|
|
2275
|
+
|
|
2040
2276
|
var _nowtime = createNowTime();
|
|
2277
|
+
|
|
2041
2278
|
var defaultOptions$1 = {
|
|
2042
2279
|
originTime: 0,
|
|
2043
2280
|
playbackRate: 1.0
|
|
2044
2281
|
};
|
|
2282
|
+
|
|
2045
2283
|
var Timeline = function () {
|
|
2046
2284
|
function Timeline(options, parent) {
|
|
2047
2285
|
if (options instanceof Timeline) {
|
|
2048
2286
|
parent = options;
|
|
2049
2287
|
options = {};
|
|
2050
2288
|
}
|
|
2289
|
+
|
|
2051
2290
|
options = _extends({}, defaultOptions$1, options);
|
|
2291
|
+
|
|
2052
2292
|
if (parent) {
|
|
2053
2293
|
this._parent = parent;
|
|
2054
2294
|
}
|
|
2295
|
+
|
|
2055
2296
|
this._createTime = _nowtime();
|
|
2056
2297
|
this._timeMark = [{
|
|
2057
2298
|
globalTime: this.globalTime,
|
|
@@ -2060,11 +2301,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2060
2301
|
playbackRate: options.playbackRate,
|
|
2061
2302
|
globalEntropy: 0
|
|
2062
2303
|
}];
|
|
2304
|
+
|
|
2063
2305
|
if (this._parent) {
|
|
2064
2306
|
this._timeMark[0].globalEntropy = this._parent.entropy;
|
|
2065
2307
|
}
|
|
2308
|
+
|
|
2066
2309
|
this._playbackRate = options.playbackRate;
|
|
2067
2310
|
}
|
|
2311
|
+
|
|
2068
2312
|
Object.defineProperty(Timeline.prototype, "globalTime", {
|
|
2069
2313
|
get: function get() {
|
|
2070
2314
|
return this.parent ? this.parent.currentTime : _nowtime() - this._createTime;
|
|
@@ -2086,14 +2330,16 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2086
2330
|
enumerable: false,
|
|
2087
2331
|
configurable: true
|
|
2088
2332
|
});
|
|
2333
|
+
|
|
2089
2334
|
Timeline.prototype.markTime = function (_a) {
|
|
2090
2335
|
var _b = _a === void 0 ? {} : _a,
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2336
|
+
_c = _b.time,
|
|
2337
|
+
time = _c === void 0 ? this.currentTime : _c,
|
|
2338
|
+
_d = _b.entropy,
|
|
2339
|
+
entropy = _d === void 0 ? this.entropy : _d,
|
|
2340
|
+
_e = _b.playbackRate,
|
|
2341
|
+
playbackRate = _e === void 0 ? this.playbackRate : _e;
|
|
2342
|
+
|
|
2097
2343
|
var timeMark = {
|
|
2098
2344
|
globalTime: this.globalTime,
|
|
2099
2345
|
localTime: time,
|
|
@@ -2101,13 +2347,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2101
2347
|
playbackRate: playbackRate,
|
|
2102
2348
|
globalEntropy: this.globalEntropy
|
|
2103
2349
|
};
|
|
2350
|
+
|
|
2104
2351
|
this._timeMark.push(timeMark);
|
|
2105
2352
|
};
|
|
2353
|
+
|
|
2106
2354
|
Object.defineProperty(Timeline.prototype, "currentTime", {
|
|
2107
2355
|
get: function get() {
|
|
2108
2356
|
var _a = this.lastTimeMark,
|
|
2109
|
-
|
|
2110
|
-
|
|
2357
|
+
localTime = _a.localTime,
|
|
2358
|
+
globalTime = _a.globalTime;
|
|
2111
2359
|
return localTime + (this.globalTime - globalTime) * this.playbackRate;
|
|
2112
2360
|
},
|
|
2113
2361
|
set: function set(time) {
|
|
@@ -2128,8 +2376,8 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2128
2376
|
Object.defineProperty(Timeline.prototype, "entropy", {
|
|
2129
2377
|
get: function get() {
|
|
2130
2378
|
var _a = this.lastTimeMark,
|
|
2131
|
-
|
|
2132
|
-
|
|
2379
|
+
entropy = _a.entropy,
|
|
2380
|
+
globalEntropy = _a.globalEntropy;
|
|
2133
2381
|
return entropy + Math.abs((this.globalEntropy - globalEntropy) * this.playbackRate);
|
|
2134
2382
|
},
|
|
2135
2383
|
set: function set(entropy) {
|
|
@@ -2137,6 +2385,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2137
2385
|
var idx = this.seekTimeMark(entropy);
|
|
2138
2386
|
this._timeMark.length = idx + 1;
|
|
2139
2387
|
}
|
|
2388
|
+
|
|
2140
2389
|
this.markTime({
|
|
2141
2390
|
entropy: entropy
|
|
2142
2391
|
});
|
|
@@ -2144,52 +2393,66 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2144
2393
|
enumerable: false,
|
|
2145
2394
|
configurable: true
|
|
2146
2395
|
});
|
|
2396
|
+
|
|
2147
2397
|
Timeline.prototype.fork = function (options) {
|
|
2148
2398
|
return new Timeline(options, this);
|
|
2149
2399
|
};
|
|
2400
|
+
|
|
2150
2401
|
Timeline.prototype.seekGlobalTime = function (seekEntropy) {
|
|
2151
2402
|
var idx = this.seekTimeMark(seekEntropy),
|
|
2152
|
-
|
|
2403
|
+
timeMark = this._timeMark[idx];
|
|
2153
2404
|
var entropy = timeMark.entropy,
|
|
2154
|
-
|
|
2155
|
-
|
|
2405
|
+
playbackRate = timeMark.playbackRate,
|
|
2406
|
+
globalTime = timeMark.globalTime;
|
|
2156
2407
|
return globalTime + (seekEntropy - entropy) / Math.abs(playbackRate);
|
|
2157
2408
|
};
|
|
2409
|
+
|
|
2158
2410
|
Timeline.prototype.seekLocalTime = function (seekEntropy) {
|
|
2159
2411
|
var idx = this.seekTimeMark(seekEntropy),
|
|
2160
|
-
|
|
2412
|
+
timeMark = this._timeMark[idx];
|
|
2161
2413
|
var localTime = timeMark.localTime,
|
|
2162
|
-
|
|
2163
|
-
|
|
2414
|
+
entropy = timeMark.entropy,
|
|
2415
|
+
playbackRate = timeMark.playbackRate;
|
|
2416
|
+
|
|
2164
2417
|
if (playbackRate > 0) {
|
|
2165
2418
|
return localTime + (seekEntropy - entropy);
|
|
2166
2419
|
}
|
|
2420
|
+
|
|
2167
2421
|
return localTime - (seekEntropy - entropy);
|
|
2168
2422
|
};
|
|
2423
|
+
|
|
2169
2424
|
Timeline.prototype.seekTimeMark = function (entropy) {
|
|
2170
2425
|
var timeMark = this._timeMark;
|
|
2171
2426
|
var l = 0,
|
|
2172
|
-
|
|
2427
|
+
r = timeMark.length - 1;
|
|
2428
|
+
|
|
2173
2429
|
if (entropy <= timeMark[l].entropy) {
|
|
2174
2430
|
return l;
|
|
2175
2431
|
}
|
|
2432
|
+
|
|
2176
2433
|
if (entropy >= timeMark[r].entropy) {
|
|
2177
2434
|
return r;
|
|
2178
2435
|
}
|
|
2436
|
+
|
|
2179
2437
|
var m = Math.floor((l + r) / 2);
|
|
2438
|
+
|
|
2180
2439
|
while (m > l && m < r) {
|
|
2181
2440
|
if (entropy === timeMark[m].entropy) {
|
|
2182
2441
|
return m;
|
|
2183
2442
|
}
|
|
2443
|
+
|
|
2184
2444
|
if (entropy < timeMark[m].entropy) {
|
|
2185
2445
|
r = m;
|
|
2186
2446
|
} else if (entropy > timeMark[m].entropy) {
|
|
2187
2447
|
l = m;
|
|
2188
2448
|
}
|
|
2449
|
+
|
|
2189
2450
|
m = Math.floor((l + r) / 2);
|
|
2190
2451
|
}
|
|
2452
|
+
|
|
2191
2453
|
return l;
|
|
2192
2454
|
};
|
|
2455
|
+
|
|
2193
2456
|
Object.defineProperty(Timeline.prototype, "playbackRate", {
|
|
2194
2457
|
get: function get() {
|
|
2195
2458
|
return this._playbackRate;
|
|
@@ -2209,10 +2472,12 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2209
2472
|
get: function get() {
|
|
2210
2473
|
if (this.playbackRate === 0) return true;
|
|
2211
2474
|
var parent = this.parent;
|
|
2475
|
+
|
|
2212
2476
|
while (parent) {
|
|
2213
2477
|
if (parent.playbackRate === 0) return true;
|
|
2214
2478
|
parent = parent.parent;
|
|
2215
2479
|
}
|
|
2480
|
+
|
|
2216
2481
|
return false;
|
|
2217
2482
|
},
|
|
2218
2483
|
enumerable: false,
|
|
@@ -2220,14 +2485,17 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2220
2485
|
});
|
|
2221
2486
|
return Timeline;
|
|
2222
2487
|
}();
|
|
2488
|
+
|
|
2223
2489
|
var Timeline$1 = Timeline;
|
|
2224
2490
|
var defaultOptions = {
|
|
2225
2491
|
autoStart: true,
|
|
2226
2492
|
frameRate: 60
|
|
2227
2493
|
};
|
|
2494
|
+
|
|
2228
2495
|
var Ticker = function () {
|
|
2229
2496
|
function Ticker(options) {
|
|
2230
2497
|
var _this = this;
|
|
2498
|
+
|
|
2231
2499
|
options = _extends({}, defaultOptions, options);
|
|
2232
2500
|
this._frameCount = 0;
|
|
2233
2501
|
this._frameDuration = 1000 / options.frameRate;
|
|
@@ -2240,20 +2508,26 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2240
2508
|
this._lastFrameTime = this.timeline.currentTime;
|
|
2241
2509
|
this._tickers = new Set();
|
|
2242
2510
|
this._requestId = null;
|
|
2511
|
+
|
|
2243
2512
|
this._ticker = function () {
|
|
2244
2513
|
if (_this._started) {
|
|
2245
2514
|
_this._requestId = requestAnimationFrame(_this._ticker);
|
|
2515
|
+
|
|
2246
2516
|
_this.update();
|
|
2247
2517
|
}
|
|
2248
2518
|
};
|
|
2519
|
+
|
|
2249
2520
|
if (this.autoStart) {
|
|
2250
2521
|
this.start();
|
|
2251
2522
|
}
|
|
2252
2523
|
}
|
|
2524
|
+
|
|
2253
2525
|
Ticker.prototype.update = function () {
|
|
2254
2526
|
var e_1, _a;
|
|
2527
|
+
|
|
2255
2528
|
var currentTime = this.timeline.currentTime;
|
|
2256
2529
|
var durationTime = currentTime - this._lastFrameTime;
|
|
2530
|
+
|
|
2257
2531
|
if (durationTime >= this._frameDuration) {
|
|
2258
2532
|
var frameTime = currentTime - durationTime % this._frameDuration;
|
|
2259
2533
|
var deltaTime = frameTime - this._lastFrameTime;
|
|
@@ -2265,9 +2539,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2265
2539
|
frameCount: ++this._frameCount,
|
|
2266
2540
|
fps: Math.round(1000 / deltaTime)
|
|
2267
2541
|
};
|
|
2542
|
+
|
|
2268
2543
|
try {
|
|
2269
2544
|
for (var _b = __values(this._tickers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2270
2545
|
var func = _c.value;
|
|
2546
|
+
|
|
2271
2547
|
if (typeof func === 'function') {
|
|
2272
2548
|
func(options);
|
|
2273
2549
|
}
|
|
@@ -2285,68 +2561,91 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2285
2561
|
}
|
|
2286
2562
|
}
|
|
2287
2563
|
};
|
|
2564
|
+
|
|
2288
2565
|
Ticker.prototype.add = function (fn) {
|
|
2289
2566
|
this._tickers.add(fn);
|
|
2290
2567
|
};
|
|
2568
|
+
|
|
2291
2569
|
Ticker.prototype.remove = function (fn) {
|
|
2292
2570
|
this._tickers.delete(fn);
|
|
2293
2571
|
};
|
|
2572
|
+
|
|
2294
2573
|
Ticker.prototype.start = function () {
|
|
2295
2574
|
if (this._started) return;
|
|
2296
2575
|
this._started = true;
|
|
2297
2576
|
this.timeline.playbackRate = 1.0;
|
|
2298
2577
|
this._requestId = requestAnimationFrame(this._ticker);
|
|
2299
2578
|
};
|
|
2579
|
+
|
|
2300
2580
|
Ticker.prototype.pause = function () {
|
|
2301
2581
|
this._started = false;
|
|
2302
2582
|
this.timeline.playbackRate = 0;
|
|
2303
2583
|
};
|
|
2584
|
+
|
|
2304
2585
|
Ticker.prototype.setPlaybackRate = function (rate) {
|
|
2305
2586
|
this.timeline.playbackRate = rate;
|
|
2306
2587
|
};
|
|
2588
|
+
|
|
2307
2589
|
return Ticker;
|
|
2308
2590
|
}();
|
|
2591
|
+
|
|
2309
2592
|
var Ticker$1 = Ticker;
|
|
2593
|
+
|
|
2310
2594
|
var Scene = function (_super) {
|
|
2311
2595
|
__extends$1(Scene, _super);
|
|
2596
|
+
|
|
2312
2597
|
function Scene(name, obj) {
|
|
2313
2598
|
var _this = _super.call(this, name, obj) || this;
|
|
2599
|
+
|
|
2314
2600
|
_this.gameObjects = [];
|
|
2315
2601
|
_this.scene = _this;
|
|
2316
2602
|
return _this;
|
|
2317
2603
|
}
|
|
2604
|
+
|
|
2318
2605
|
Scene.prototype.addGameObject = function (gameObject) {
|
|
2319
2606
|
this.gameObjects.push(gameObject);
|
|
2607
|
+
|
|
2320
2608
|
if (gameObject.transform) {
|
|
2321
2609
|
gameObject.transform.inScene = true;
|
|
2322
2610
|
}
|
|
2323
2611
|
};
|
|
2612
|
+
|
|
2324
2613
|
Scene.prototype.removeGameObject = function (gameObject) {
|
|
2325
2614
|
var index = this.gameObjects.indexOf(gameObject);
|
|
2326
2615
|
if (index === -1) return;
|
|
2616
|
+
|
|
2327
2617
|
if (gameObject.transform) {
|
|
2328
2618
|
gameObject.transform.inScene = false;
|
|
2329
2619
|
}
|
|
2620
|
+
|
|
2330
2621
|
this.gameObjects.splice(index, 1);
|
|
2331
2622
|
};
|
|
2623
|
+
|
|
2332
2624
|
Scene.prototype.destroy = function () {
|
|
2333
2625
|
this.scene = null;
|
|
2626
|
+
|
|
2334
2627
|
_super.prototype.destroy.call(this);
|
|
2628
|
+
|
|
2335
2629
|
this.gameObjects = null;
|
|
2336
2630
|
this.canvas = null;
|
|
2337
2631
|
};
|
|
2632
|
+
|
|
2338
2633
|
return Scene;
|
|
2339
2634
|
}(GameObject$1);
|
|
2635
|
+
|
|
2340
2636
|
var Scene$1 = Scene;
|
|
2341
2637
|
exports.LOAD_SCENE_MODE = void 0;
|
|
2638
|
+
|
|
2342
2639
|
(function (LOAD_SCENE_MODE) {
|
|
2343
2640
|
LOAD_SCENE_MODE["SINGLE"] = "SINGLE";
|
|
2344
2641
|
LOAD_SCENE_MODE["MULTI_CANVAS"] = "MULTI_CANVAS";
|
|
2345
2642
|
})(exports.LOAD_SCENE_MODE || (exports.LOAD_SCENE_MODE = {}));
|
|
2643
|
+
|
|
2346
2644
|
var triggerStart = function triggerStart(obj) {
|
|
2347
2645
|
if (!(obj instanceof System$1) && !(obj instanceof Component$1)) return;
|
|
2348
2646
|
if (obj.started) return;
|
|
2349
2647
|
obj.started = true;
|
|
2648
|
+
|
|
2350
2649
|
try {
|
|
2351
2650
|
obj.start && obj.start();
|
|
2352
2651
|
} catch (e) {
|
|
@@ -2357,15 +2656,19 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2357
2656
|
}
|
|
2358
2657
|
}
|
|
2359
2658
|
};
|
|
2659
|
+
|
|
2360
2660
|
var getAllGameObjects = function getAllGameObjects(game) {
|
|
2361
2661
|
var e_1, _a;
|
|
2662
|
+
|
|
2362
2663
|
var _b;
|
|
2664
|
+
|
|
2363
2665
|
var mainSceneGameObjects = ((_b = game === null || game === void 0 ? void 0 : game.scene) === null || _b === void 0 ? void 0 : _b.gameObjects) || [];
|
|
2364
2666
|
var gameObjectsArray = game === null || game === void 0 ? void 0 : game.multiScenes.map(function (_a) {
|
|
2365
2667
|
var gameObjects = _a.gameObjects;
|
|
2366
2668
|
return gameObjects;
|
|
2367
2669
|
});
|
|
2368
2670
|
var otherSceneGameObjects = [];
|
|
2671
|
+
|
|
2369
2672
|
try {
|
|
2370
2673
|
for (var gameObjectsArray_1 = __values(gameObjectsArray), gameObjectsArray_1_1 = gameObjectsArray_1.next(); !gameObjectsArray_1_1.done; gameObjectsArray_1_1 = gameObjectsArray_1.next()) {
|
|
2371
2674
|
var gameObjects = gameObjectsArray_1_1.value;
|
|
@@ -2382,19 +2685,25 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2382
2685
|
if (e_1) throw e_1.error;
|
|
2383
2686
|
}
|
|
2384
2687
|
}
|
|
2688
|
+
|
|
2385
2689
|
return __spread(mainSceneGameObjects, otherSceneGameObjects);
|
|
2386
2690
|
};
|
|
2691
|
+
|
|
2387
2692
|
var gameObjectLoop = function gameObjectLoop(e, gameObjects) {
|
|
2388
2693
|
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
2694
|
+
|
|
2389
2695
|
if (gameObjects === void 0) {
|
|
2390
2696
|
gameObjects = [];
|
|
2391
2697
|
}
|
|
2698
|
+
|
|
2392
2699
|
try {
|
|
2393
2700
|
for (var gameObjects_1 = __values(gameObjects), gameObjects_1_1 = gameObjects_1.next(); !gameObjects_1_1.done; gameObjects_1_1 = gameObjects_1.next()) {
|
|
2394
2701
|
var gameObject = gameObjects_1_1.value;
|
|
2702
|
+
|
|
2395
2703
|
try {
|
|
2396
2704
|
for (var _e = (e_3 = void 0, __values(gameObject.components)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
2397
2705
|
var component = _f.value;
|
|
2706
|
+
|
|
2398
2707
|
try {
|
|
2399
2708
|
triggerStart(component);
|
|
2400
2709
|
component.update && component.update(e);
|
|
@@ -2425,12 +2734,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2425
2734
|
if (e_2) throw e_2.error;
|
|
2426
2735
|
}
|
|
2427
2736
|
}
|
|
2737
|
+
|
|
2428
2738
|
try {
|
|
2429
2739
|
for (var gameObjects_2 = __values(gameObjects), gameObjects_2_1 = gameObjects_2.next(); !gameObjects_2_1.done; gameObjects_2_1 = gameObjects_2.next()) {
|
|
2430
2740
|
var gameObject = gameObjects_2_1.value;
|
|
2741
|
+
|
|
2431
2742
|
try {
|
|
2432
2743
|
for (var _g = (e_5 = void 0, __values(gameObject.components)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
2433
2744
|
var component = _h.value;
|
|
2745
|
+
|
|
2434
2746
|
try {
|
|
2435
2747
|
component.lateUpdate && component.lateUpdate(e);
|
|
2436
2748
|
} catch (e) {
|
|
@@ -2461,14 +2773,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2461
2773
|
}
|
|
2462
2774
|
}
|
|
2463
2775
|
};
|
|
2776
|
+
|
|
2464
2777
|
var gameObjectResume = function gameObjectResume(gameObjects) {
|
|
2465
2778
|
var e_6, _a, e_7, _b;
|
|
2779
|
+
|
|
2466
2780
|
try {
|
|
2467
2781
|
for (var gameObjects_3 = __values(gameObjects), gameObjects_3_1 = gameObjects_3.next(); !gameObjects_3_1.done; gameObjects_3_1 = gameObjects_3.next()) {
|
|
2468
2782
|
var gameObject = gameObjects_3_1.value;
|
|
2783
|
+
|
|
2469
2784
|
try {
|
|
2470
2785
|
for (var _c = (e_7 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2471
2786
|
var component = _d.value;
|
|
2787
|
+
|
|
2472
2788
|
try {
|
|
2473
2789
|
component.onResume && component.onResume();
|
|
2474
2790
|
} catch (e) {
|
|
@@ -2499,14 +2815,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2499
2815
|
}
|
|
2500
2816
|
}
|
|
2501
2817
|
};
|
|
2818
|
+
|
|
2502
2819
|
var gameObjectPause = function gameObjectPause(gameObjects) {
|
|
2503
2820
|
var e_8, _a, e_9, _b;
|
|
2821
|
+
|
|
2504
2822
|
try {
|
|
2505
2823
|
for (var gameObjects_4 = __values(gameObjects), gameObjects_4_1 = gameObjects_4.next(); !gameObjects_4_1.done; gameObjects_4_1 = gameObjects_4.next()) {
|
|
2506
2824
|
var gameObject = gameObjects_4_1.value;
|
|
2825
|
+
|
|
2507
2826
|
try {
|
|
2508
2827
|
for (var _c = (e_9 = void 0, __values(gameObject.components)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2509
2828
|
var component = _d.value;
|
|
2829
|
+
|
|
2510
2830
|
try {
|
|
2511
2831
|
component.onPause && component.onPause();
|
|
2512
2832
|
} catch (e) {
|
|
@@ -2537,35 +2857,45 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2537
2857
|
}
|
|
2538
2858
|
}
|
|
2539
2859
|
};
|
|
2860
|
+
|
|
2540
2861
|
var Game = function (_super) {
|
|
2541
2862
|
__extends$1(Game, _super);
|
|
2863
|
+
|
|
2542
2864
|
function Game(_a) {
|
|
2543
2865
|
var e_10, _b;
|
|
2866
|
+
|
|
2544
2867
|
var _c = _a === void 0 ? {} : _a,
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2868
|
+
systems = _c.systems,
|
|
2869
|
+
_d = _c.frameRate,
|
|
2870
|
+
frameRate = _d === void 0 ? 60 : _d,
|
|
2871
|
+
_e = _c.autoStart,
|
|
2872
|
+
autoStart = _e === void 0 ? true : _e,
|
|
2873
|
+
_f = _c.needScene,
|
|
2874
|
+
needScene = _f === void 0 ? true : _f;
|
|
2875
|
+
|
|
2552
2876
|
var _this = _super.call(this) || this;
|
|
2877
|
+
|
|
2553
2878
|
_this.playing = false;
|
|
2554
2879
|
_this.started = false;
|
|
2555
2880
|
_this.multiScenes = [];
|
|
2556
2881
|
_this.systems = [];
|
|
2882
|
+
|
|
2557
2883
|
if (window.__EVA_INSPECTOR_ENV__) {
|
|
2558
2884
|
window.__EVA_GAME_INSTANCE__ = _this;
|
|
2559
2885
|
}
|
|
2886
|
+
|
|
2560
2887
|
_this.ticker = new Ticker$1({
|
|
2561
2888
|
autoStart: false,
|
|
2562
2889
|
frameRate: frameRate
|
|
2563
2890
|
});
|
|
2891
|
+
|
|
2564
2892
|
_this.initTicker();
|
|
2893
|
+
|
|
2565
2894
|
if (systems && systems.length) {
|
|
2566
2895
|
try {
|
|
2567
2896
|
for (var systems_1 = __values(systems), systems_1_1 = systems_1.next(); !systems_1_1.done; systems_1_1 = systems_1.next()) {
|
|
2568
2897
|
var system = systems_1_1.value;
|
|
2898
|
+
|
|
2569
2899
|
_this.addSystem(system);
|
|
2570
2900
|
}
|
|
2571
2901
|
} catch (e_10_1) {
|
|
@@ -2580,14 +2910,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2580
2910
|
}
|
|
2581
2911
|
}
|
|
2582
2912
|
}
|
|
2913
|
+
|
|
2583
2914
|
if (needScene) {
|
|
2584
2915
|
_this.loadScene(new Scene$1('scene'));
|
|
2585
2916
|
}
|
|
2917
|
+
|
|
2586
2918
|
if (autoStart) {
|
|
2587
2919
|
_this.start();
|
|
2588
2920
|
}
|
|
2921
|
+
|
|
2589
2922
|
return _this;
|
|
2590
2923
|
}
|
|
2924
|
+
|
|
2591
2925
|
Object.defineProperty(Game.prototype, "scene", {
|
|
2592
2926
|
get: function get() {
|
|
2593
2927
|
return this._scene;
|
|
@@ -2605,8 +2939,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2605
2939
|
enumerable: false,
|
|
2606
2940
|
configurable: true
|
|
2607
2941
|
});
|
|
2942
|
+
|
|
2608
2943
|
Game.prototype.addSystem = function (S, obj) {
|
|
2609
2944
|
var system;
|
|
2945
|
+
|
|
2610
2946
|
if (S instanceof Function) {
|
|
2611
2947
|
system = new S(obj);
|
|
2612
2948
|
} else if (S instanceof System$1) {
|
|
@@ -2615,28 +2951,35 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2615
2951
|
console.warn('can only add System');
|
|
2616
2952
|
return;
|
|
2617
2953
|
}
|
|
2954
|
+
|
|
2618
2955
|
var hasTheSystem = this.systems.find(function (item) {
|
|
2619
2956
|
return item.constructor === system.constructor;
|
|
2620
2957
|
});
|
|
2958
|
+
|
|
2621
2959
|
if (hasTheSystem) {
|
|
2622
2960
|
console.warn(system.constructor.systemName + " System has been added");
|
|
2623
2961
|
return;
|
|
2624
2962
|
}
|
|
2963
|
+
|
|
2625
2964
|
system.game = this;
|
|
2626
2965
|
system.init && system.init(system.__systemDefaultParams);
|
|
2627
2966
|
setSystemObserver(system, system.constructor);
|
|
2628
2967
|
initObserver(system.constructor);
|
|
2968
|
+
|
|
2629
2969
|
try {
|
|
2630
2970
|
system.awake && system.awake();
|
|
2631
2971
|
} catch (e) {
|
|
2632
2972
|
console.error(system.constructor.systemName + " awake error", e);
|
|
2633
2973
|
}
|
|
2974
|
+
|
|
2634
2975
|
this.systems.push(system);
|
|
2635
2976
|
return system;
|
|
2636
2977
|
};
|
|
2978
|
+
|
|
2637
2979
|
Game.prototype.removeSystem = function (system) {
|
|
2638
2980
|
if (!system) return;
|
|
2639
2981
|
var index = -1;
|
|
2982
|
+
|
|
2640
2983
|
if (typeof system === 'string') {
|
|
2641
2984
|
index = this.systems.findIndex(function (s) {
|
|
2642
2985
|
return s.name === system;
|
|
@@ -2650,11 +2993,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2650
2993
|
return s === system;
|
|
2651
2994
|
});
|
|
2652
2995
|
}
|
|
2996
|
+
|
|
2653
2997
|
if (index > -1) {
|
|
2654
2998
|
this.systems[index].destroy && this.systems[index].destroy();
|
|
2655
2999
|
this.systems.splice(index, 1);
|
|
2656
3000
|
}
|
|
2657
3001
|
};
|
|
3002
|
+
|
|
2658
3003
|
Game.prototype.getSystem = function (S) {
|
|
2659
3004
|
return this.systems.find(function (system) {
|
|
2660
3005
|
if (typeof S === 'string') {
|
|
@@ -2664,32 +3009,40 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2664
3009
|
}
|
|
2665
3010
|
});
|
|
2666
3011
|
};
|
|
3012
|
+
|
|
2667
3013
|
Game.prototype.pause = function () {
|
|
2668
3014
|
if (!this.playing) return;
|
|
2669
3015
|
this.playing = false;
|
|
2670
3016
|
this.ticker.pause();
|
|
2671
3017
|
this.triggerPause();
|
|
2672
3018
|
};
|
|
3019
|
+
|
|
2673
3020
|
Game.prototype.start = function () {
|
|
2674
3021
|
if (this.playing) return;
|
|
2675
3022
|
this.playing = true;
|
|
2676
3023
|
this.started = true;
|
|
2677
3024
|
this.ticker.start();
|
|
2678
3025
|
};
|
|
3026
|
+
|
|
2679
3027
|
Game.prototype.resume = function () {
|
|
2680
3028
|
if (this.playing) return;
|
|
2681
3029
|
this.playing = true;
|
|
2682
3030
|
this.ticker.start();
|
|
2683
3031
|
this.triggerResume();
|
|
2684
3032
|
};
|
|
3033
|
+
|
|
2685
3034
|
Game.prototype.initTicker = function () {
|
|
2686
3035
|
var _this = this;
|
|
3036
|
+
|
|
2687
3037
|
this.ticker.add(function (e) {
|
|
2688
3038
|
var e_11, _a, e_12, _b;
|
|
3039
|
+
|
|
2689
3040
|
_this.scene && gameObjectLoop(e, _this.gameObjects);
|
|
3041
|
+
|
|
2690
3042
|
try {
|
|
2691
3043
|
for (var _c = __values(_this.systems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2692
3044
|
var system = _d.value;
|
|
3045
|
+
|
|
2693
3046
|
try {
|
|
2694
3047
|
triggerStart(system);
|
|
2695
3048
|
system.update && system.update(e);
|
|
@@ -2708,9 +3061,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2708
3061
|
if (e_11) throw e_11.error;
|
|
2709
3062
|
}
|
|
2710
3063
|
}
|
|
3064
|
+
|
|
2711
3065
|
try {
|
|
2712
3066
|
for (var _e = __values(_this.systems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
2713
3067
|
var system = _f.value;
|
|
3068
|
+
|
|
2714
3069
|
try {
|
|
2715
3070
|
system.lateUpdate && system.lateUpdate(e);
|
|
2716
3071
|
} catch (e) {
|
|
@@ -2730,12 +3085,16 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2730
3085
|
}
|
|
2731
3086
|
});
|
|
2732
3087
|
};
|
|
3088
|
+
|
|
2733
3089
|
Game.prototype.triggerResume = function () {
|
|
2734
3090
|
var e_13, _a;
|
|
3091
|
+
|
|
2735
3092
|
gameObjectResume(this.gameObjects);
|
|
3093
|
+
|
|
2736
3094
|
try {
|
|
2737
3095
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2738
3096
|
var system = _c.value;
|
|
3097
|
+
|
|
2739
3098
|
try {
|
|
2740
3099
|
system.onResume && system.onResume();
|
|
2741
3100
|
} catch (e) {
|
|
@@ -2754,12 +3113,16 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2754
3113
|
}
|
|
2755
3114
|
}
|
|
2756
3115
|
};
|
|
3116
|
+
|
|
2757
3117
|
Game.prototype.triggerPause = function () {
|
|
2758
3118
|
var e_14, _a;
|
|
3119
|
+
|
|
2759
3120
|
gameObjectPause(this.gameObjects);
|
|
3121
|
+
|
|
2760
3122
|
try {
|
|
2761
3123
|
for (var _b = __values(this.systems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2762
3124
|
var system = _c.value;
|
|
3125
|
+
|
|
2763
3126
|
try {
|
|
2764
3127
|
system.onPause && system.onPause();
|
|
2765
3128
|
} catch (e) {
|
|
@@ -2778,8 +3141,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2778
3141
|
}
|
|
2779
3142
|
}
|
|
2780
3143
|
};
|
|
3144
|
+
|
|
2781
3145
|
Game.prototype.destroySystems = function () {
|
|
2782
3146
|
var e_15, _a;
|
|
3147
|
+
|
|
2783
3148
|
try {
|
|
2784
3149
|
for (var _b = __values(__spread(this.systems)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2785
3150
|
var system = _c.value;
|
|
@@ -2796,8 +3161,10 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2796
3161
|
if (e_15) throw e_15.error;
|
|
2797
3162
|
}
|
|
2798
3163
|
}
|
|
3164
|
+
|
|
2799
3165
|
this.systems.length = 0;
|
|
2800
3166
|
};
|
|
3167
|
+
|
|
2801
3168
|
Game.prototype.destroy = function () {
|
|
2802
3169
|
this.removeAllListeners();
|
|
2803
3170
|
this.pause();
|
|
@@ -2808,42 +3175,53 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2808
3175
|
this.canvas = null;
|
|
2809
3176
|
this.multiScenes = null;
|
|
2810
3177
|
};
|
|
3178
|
+
|
|
2811
3179
|
Game.prototype.loadScene = function (_a) {
|
|
2812
3180
|
var scene = _a.scene,
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
3181
|
+
_b = _a.mode,
|
|
3182
|
+
mode = _b === void 0 ? exports.LOAD_SCENE_MODE.SINGLE : _b,
|
|
3183
|
+
_c = _a.params,
|
|
3184
|
+
params = _c === void 0 ? {} : _c;
|
|
3185
|
+
|
|
2817
3186
|
if (!scene) {
|
|
2818
3187
|
return;
|
|
2819
3188
|
}
|
|
3189
|
+
|
|
2820
3190
|
switch (mode) {
|
|
2821
3191
|
case exports.LOAD_SCENE_MODE.SINGLE:
|
|
2822
3192
|
this.scene = scene;
|
|
2823
3193
|
break;
|
|
3194
|
+
|
|
2824
3195
|
case exports.LOAD_SCENE_MODE.MULTI_CANVAS:
|
|
2825
3196
|
this.multiScenes.push(scene);
|
|
2826
3197
|
break;
|
|
2827
3198
|
}
|
|
3199
|
+
|
|
2828
3200
|
this.emit('sceneChanged', {
|
|
2829
3201
|
scene: scene,
|
|
2830
3202
|
mode: mode,
|
|
2831
3203
|
params: params
|
|
2832
3204
|
});
|
|
2833
3205
|
};
|
|
3206
|
+
|
|
2834
3207
|
return Game;
|
|
2835
3208
|
}(EE);
|
|
3209
|
+
|
|
2836
3210
|
var Game$1 = Game;
|
|
3211
|
+
|
|
2837
3212
|
function IDEProp(target, propertyKey) {
|
|
2838
3213
|
if (!target.constructor.IDEProps) {
|
|
2839
3214
|
target.constructor.IDEProps = [];
|
|
2840
3215
|
}
|
|
3216
|
+
|
|
2841
3217
|
target.constructor.IDEProps.push(propertyKey);
|
|
2842
3218
|
}
|
|
3219
|
+
|
|
2843
3220
|
function componentObserver(observerInfo) {
|
|
2844
3221
|
if (observerInfo === void 0) {
|
|
2845
3222
|
observerInfo = {};
|
|
2846
3223
|
}
|
|
3224
|
+
|
|
2847
3225
|
return function (constructor) {
|
|
2848
3226
|
if (!constructor.observerInfo) {
|
|
2849
3227
|
for (var key in observerInfo) {
|
|
@@ -2851,7 +3229,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2851
3229
|
if (typeof observerInfo[key][index] === 'string') {
|
|
2852
3230
|
observerInfo[key][index] = [observerInfo[key][index]];
|
|
2853
3231
|
}
|
|
3232
|
+
|
|
2854
3233
|
var observerProp = void 0;
|
|
3234
|
+
|
|
2855
3235
|
if (Array.isArray(observerInfo[key][index])) {
|
|
2856
3236
|
observerProp = {
|
|
2857
3237
|
prop: observerInfo[key][index],
|
|
@@ -2859,12 +3239,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2859
3239
|
};
|
|
2860
3240
|
observerInfo[key][index] = observerProp;
|
|
2861
3241
|
}
|
|
3242
|
+
|
|
2862
3243
|
observerProp = observerInfo[key][index];
|
|
3244
|
+
|
|
2863
3245
|
if (typeof observerProp.prop === 'string') {
|
|
2864
3246
|
observerProp.prop = [observerProp.prop];
|
|
2865
3247
|
}
|
|
2866
3248
|
}
|
|
2867
3249
|
}
|
|
3250
|
+
|
|
2868
3251
|
constructor.observerInfo = observerInfo;
|
|
2869
3252
|
}
|
|
2870
3253
|
};
|
|
@@ -2875,6 +3258,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2875
3258
|
if (once === void 0) {
|
|
2876
3259
|
once = false;
|
|
2877
3260
|
}
|
|
3261
|
+
|
|
2878
3262
|
this.next = null;
|
|
2879
3263
|
this.prev = null;
|
|
2880
3264
|
this.owner = null;
|
|
@@ -2882,71 +3266,92 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2882
3266
|
this.once = once;
|
|
2883
3267
|
this.thisArg = thisArg;
|
|
2884
3268
|
}
|
|
3269
|
+
|
|
2885
3270
|
SignalBindingImpl.prototype.detach = function () {
|
|
2886
3271
|
if (this.owner === null) return false;
|
|
2887
3272
|
this.owner.detach(this);
|
|
2888
3273
|
return true;
|
|
2889
3274
|
};
|
|
3275
|
+
|
|
2890
3276
|
SignalBindingImpl.prototype.dispose = function () {
|
|
2891
3277
|
this.detach();
|
|
2892
3278
|
};
|
|
3279
|
+
|
|
2893
3280
|
return SignalBindingImpl;
|
|
2894
3281
|
}();
|
|
3282
|
+
|
|
2895
3283
|
var Signal = function () {
|
|
2896
3284
|
function Signal() {
|
|
2897
3285
|
this._head = null;
|
|
2898
3286
|
this._tail = null;
|
|
2899
3287
|
this._filter = null;
|
|
2900
3288
|
}
|
|
3289
|
+
|
|
2901
3290
|
Signal.prototype.handlers = function () {
|
|
2902
3291
|
var node = this._head;
|
|
2903
3292
|
var handlers = [];
|
|
3293
|
+
|
|
2904
3294
|
while (node) {
|
|
2905
3295
|
handlers.push(node);
|
|
2906
3296
|
node = node.next;
|
|
2907
3297
|
}
|
|
3298
|
+
|
|
2908
3299
|
return handlers;
|
|
2909
3300
|
};
|
|
3301
|
+
|
|
2910
3302
|
Signal.prototype.hasAny = function () {
|
|
2911
3303
|
return !!this._head;
|
|
2912
3304
|
};
|
|
3305
|
+
|
|
2913
3306
|
Signal.prototype.has = function (node) {
|
|
2914
3307
|
return node.owner === this;
|
|
2915
3308
|
};
|
|
3309
|
+
|
|
2916
3310
|
Signal.prototype.dispatch = function () {
|
|
2917
3311
|
var args = [];
|
|
3312
|
+
|
|
2918
3313
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2919
3314
|
args[_i] = arguments[_i];
|
|
2920
3315
|
}
|
|
3316
|
+
|
|
2921
3317
|
var node = this._head;
|
|
2922
3318
|
if (!node) return false;
|
|
2923
3319
|
if (this._filter && !this._filter.apply(this, args)) return false;
|
|
3320
|
+
|
|
2924
3321
|
while (node) {
|
|
2925
3322
|
if (node.once) this.detach(node);
|
|
2926
3323
|
node.fn.apply(node.thisArg, args);
|
|
2927
3324
|
node = node.next;
|
|
2928
3325
|
}
|
|
3326
|
+
|
|
2929
3327
|
return true;
|
|
2930
3328
|
};
|
|
3329
|
+
|
|
2931
3330
|
Signal.prototype.add = function (fn, thisArg) {
|
|
2932
3331
|
if (thisArg === void 0) {
|
|
2933
3332
|
thisArg = null;
|
|
2934
3333
|
}
|
|
3334
|
+
|
|
2935
3335
|
return this._addSignalBinding(new SignalBindingImpl(fn, false, thisArg));
|
|
2936
3336
|
};
|
|
3337
|
+
|
|
2937
3338
|
Signal.prototype.once = function (fn, thisArg) {
|
|
2938
3339
|
if (thisArg === void 0) {
|
|
2939
3340
|
thisArg = null;
|
|
2940
3341
|
}
|
|
3342
|
+
|
|
2941
3343
|
return this._addSignalBinding(new SignalBindingImpl(fn, true, thisArg));
|
|
2942
3344
|
};
|
|
3345
|
+
|
|
2943
3346
|
Signal.prototype.detach = function (node_) {
|
|
2944
3347
|
var node = node_;
|
|
2945
3348
|
if (node.owner !== this) return this;
|
|
2946
3349
|
if (node.prev) node.prev.next = node.next;
|
|
2947
3350
|
if (node.next) node.next.prev = node.prev;
|
|
3351
|
+
|
|
2948
3352
|
if (node === this._head) {
|
|
2949
3353
|
this._head = node.next;
|
|
3354
|
+
|
|
2950
3355
|
if (node.next === null) {
|
|
2951
3356
|
this._tail = null;
|
|
2952
3357
|
}
|
|
@@ -2954,43 +3359,58 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2954
3359
|
this._tail = node.prev;
|
|
2955
3360
|
if (this._tail) this._tail.next = null;
|
|
2956
3361
|
}
|
|
3362
|
+
|
|
2957
3363
|
node.owner = null;
|
|
2958
3364
|
return this;
|
|
2959
3365
|
};
|
|
3366
|
+
|
|
2960
3367
|
Signal.prototype.detachAll = function () {
|
|
2961
3368
|
var node = this._head;
|
|
2962
3369
|
if (!node) return this;
|
|
2963
3370
|
this._head = null;
|
|
2964
3371
|
this._tail = null;
|
|
3372
|
+
|
|
2965
3373
|
while (node) {
|
|
2966
3374
|
node.owner = null;
|
|
2967
3375
|
node = node.next;
|
|
2968
3376
|
}
|
|
3377
|
+
|
|
2969
3378
|
return this;
|
|
2970
3379
|
};
|
|
3380
|
+
|
|
2971
3381
|
Signal.prototype.filter = function (filter) {
|
|
2972
3382
|
this._filter = filter;
|
|
2973
3383
|
};
|
|
3384
|
+
|
|
2974
3385
|
Signal.prototype.proxy = function () {
|
|
2975
3386
|
var _this = this;
|
|
3387
|
+
|
|
2976
3388
|
var signals = [];
|
|
3389
|
+
|
|
2977
3390
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2978
3391
|
signals[_i] = arguments[_i];
|
|
2979
3392
|
}
|
|
3393
|
+
|
|
2980
3394
|
var fn = function fn() {
|
|
2981
3395
|
var args = [];
|
|
3396
|
+
|
|
2982
3397
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2983
3398
|
args[_i] = arguments[_i];
|
|
2984
3399
|
}
|
|
3400
|
+
|
|
2985
3401
|
return _this.dispatch.apply(_this, args);
|
|
2986
3402
|
};
|
|
3403
|
+
|
|
2987
3404
|
for (var i = 0; i < signals.length; ++i) {
|
|
2988
3405
|
signals[i].add(fn);
|
|
2989
3406
|
}
|
|
3407
|
+
|
|
2990
3408
|
return this;
|
|
2991
3409
|
};
|
|
3410
|
+
|
|
2992
3411
|
Signal.prototype._addSignalBinding = function (node_) {
|
|
2993
3412
|
var node = node_;
|
|
3413
|
+
|
|
2994
3414
|
if (!this._head) {
|
|
2995
3415
|
this._head = node;
|
|
2996
3416
|
this._tail = node;
|
|
@@ -2999,15 +3419,19 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
2999
3419
|
node.prev = this._tail;
|
|
3000
3420
|
this._tail = node;
|
|
3001
3421
|
}
|
|
3422
|
+
|
|
3002
3423
|
node.owner = this;
|
|
3003
3424
|
return node;
|
|
3004
3425
|
};
|
|
3426
|
+
|
|
3005
3427
|
return Signal;
|
|
3006
3428
|
}();
|
|
3429
|
+
|
|
3007
3430
|
var src = function src(str, opts) {
|
|
3008
3431
|
if (opts === void 0) {
|
|
3009
3432
|
opts = {};
|
|
3010
3433
|
}
|
|
3434
|
+
|
|
3011
3435
|
if (!str) return undefined;
|
|
3012
3436
|
var o = {
|
|
3013
3437
|
key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
|
|
@@ -3023,15 +3447,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3023
3447
|
var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);
|
|
3024
3448
|
var uri = {};
|
|
3025
3449
|
var i = 14;
|
|
3450
|
+
|
|
3026
3451
|
while (i--) {
|
|
3027
3452
|
uri[o.key[i]] = m[i] || '';
|
|
3028
3453
|
}
|
|
3454
|
+
|
|
3029
3455
|
uri[o.q.name] = {};
|
|
3030
3456
|
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
|
|
3031
3457
|
if ($1) uri[o.q.name][$1] = $2;
|
|
3032
3458
|
});
|
|
3033
3459
|
return uri;
|
|
3034
3460
|
};
|
|
3461
|
+
|
|
3035
3462
|
var parseUri = src;
|
|
3036
3463
|
|
|
3037
3464
|
var AbstractLoadStrategy = function () {
|
|
@@ -3041,6 +3468,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3041
3468
|
this.onComplete = new Signal();
|
|
3042
3469
|
this.onProgress = new Signal();
|
|
3043
3470
|
}
|
|
3471
|
+
|
|
3044
3472
|
return AbstractLoadStrategy;
|
|
3045
3473
|
}();
|
|
3046
3474
|
|
|
@@ -3054,29 +3482,38 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3054
3482
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
3055
3483
|
}
|
|
3056
3484
|
};
|
|
3485
|
+
|
|
3057
3486
|
return _extendStatics(d, b);
|
|
3058
3487
|
};
|
|
3488
|
+
|
|
3059
3489
|
function __extends(d, b) {
|
|
3060
3490
|
_extendStatics(d, b);
|
|
3491
|
+
|
|
3061
3492
|
function __() {
|
|
3062
3493
|
this.constructor = d;
|
|
3063
3494
|
}
|
|
3495
|
+
|
|
3064
3496
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3065
3497
|
}
|
|
3498
|
+
|
|
3066
3499
|
function __spreadArrays() {
|
|
3067
3500
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
|
|
3068
3501
|
s += arguments[i].length;
|
|
3069
3502
|
}
|
|
3503
|
+
|
|
3070
3504
|
for (var r = Array(s), k = 0, i = 0; i < il; i++) {
|
|
3071
3505
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
|
|
3072
3506
|
r[k] = a[j];
|
|
3073
3507
|
}
|
|
3074
3508
|
}
|
|
3509
|
+
|
|
3075
3510
|
return r;
|
|
3076
3511
|
}
|
|
3512
|
+
|
|
3077
3513
|
function getExtension(url) {
|
|
3078
3514
|
var isDataUrl = url.indexOf('data:') === 0;
|
|
3079
3515
|
var ext = '';
|
|
3516
|
+
|
|
3080
3517
|
if (isDataUrl) {
|
|
3081
3518
|
var slashIndex = url.indexOf('/');
|
|
3082
3519
|
ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));
|
|
@@ -3087,12 +3524,16 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3087
3524
|
url = url.substring(0, index);
|
|
3088
3525
|
ext = url.substring(url.lastIndexOf('.') + 1);
|
|
3089
3526
|
}
|
|
3527
|
+
|
|
3090
3528
|
return ext.toLowerCase();
|
|
3091
3529
|
}
|
|
3530
|
+
|
|
3092
3531
|
function assertNever(x) {
|
|
3093
3532
|
throw new Error('Unexpected value. Should have been never.');
|
|
3094
3533
|
}
|
|
3534
|
+
|
|
3095
3535
|
var ResourceType;
|
|
3536
|
+
|
|
3096
3537
|
(function (ResourceType) {
|
|
3097
3538
|
ResourceType[ResourceType["Unknown"] = 0] = "Unknown";
|
|
3098
3539
|
ResourceType[ResourceType["Buffer"] = 1] = "Buffer";
|
|
@@ -3104,16 +3545,21 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3104
3545
|
ResourceType[ResourceType["Video"] = 7] = "Video";
|
|
3105
3546
|
ResourceType[ResourceType["Text"] = 8] = "Text";
|
|
3106
3547
|
})(ResourceType || (ResourceType = {}));
|
|
3548
|
+
|
|
3107
3549
|
var ResourceState;
|
|
3550
|
+
|
|
3108
3551
|
(function (ResourceState) {
|
|
3109
3552
|
ResourceState[ResourceState["NotStarted"] = 0] = "NotStarted";
|
|
3110
3553
|
ResourceState[ResourceState["Loading"] = 1] = "Loading";
|
|
3111
3554
|
ResourceState[ResourceState["Complete"] = 2] = "Complete";
|
|
3112
3555
|
})(ResourceState || (ResourceState = {}));
|
|
3556
|
+
|
|
3113
3557
|
var MediaElementLoadStrategy = function (_super) {
|
|
3114
3558
|
__extends(MediaElementLoadStrategy, _super);
|
|
3559
|
+
|
|
3115
3560
|
function MediaElementLoadStrategy(config, elementType) {
|
|
3116
3561
|
var _this = _super.call(this, config) || this;
|
|
3562
|
+
|
|
3117
3563
|
_this.elementType = elementType;
|
|
3118
3564
|
_this._boundOnLoad = _this._onLoad.bind(_this);
|
|
3119
3565
|
_this._boundOnError = _this._onError.bind(_this);
|
|
@@ -3122,10 +3568,12 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3122
3568
|
_this._elementTimer = 0;
|
|
3123
3569
|
return _this;
|
|
3124
3570
|
}
|
|
3571
|
+
|
|
3125
3572
|
MediaElementLoadStrategy.prototype.load = function () {
|
|
3126
3573
|
var config = this.config;
|
|
3127
3574
|
if (config.crossOrigin) this._element.crossOrigin = config.crossOrigin;
|
|
3128
3575
|
var urls = config.sourceSet || [config.url];
|
|
3576
|
+
|
|
3129
3577
|
if (navigator.isCocoonJS) {
|
|
3130
3578
|
this._element.src = urls[0];
|
|
3131
3579
|
} else {
|
|
@@ -3136,73 +3584,106 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3136
3584
|
var source = document.createElement('source');
|
|
3137
3585
|
source.src = url;
|
|
3138
3586
|
source.type = mimeType;
|
|
3587
|
+
|
|
3139
3588
|
this._element.appendChild(source);
|
|
3140
3589
|
}
|
|
3141
3590
|
}
|
|
3591
|
+
|
|
3142
3592
|
this._element.addEventListener('load', this._boundOnLoad, false);
|
|
3593
|
+
|
|
3143
3594
|
this._element.addEventListener('canplaythrough', this._boundOnLoad, false);
|
|
3595
|
+
|
|
3144
3596
|
this._element.addEventListener('error', this._boundOnError, false);
|
|
3597
|
+
|
|
3145
3598
|
this._element.load();
|
|
3599
|
+
|
|
3146
3600
|
if (config.timeout) this._elementTimer = window.setTimeout(this._boundOnTimeout, config.timeout);
|
|
3147
3601
|
};
|
|
3602
|
+
|
|
3148
3603
|
MediaElementLoadStrategy.prototype.abort = function () {
|
|
3149
3604
|
this._clearEvents();
|
|
3605
|
+
|
|
3150
3606
|
while (this._element.firstChild) {
|
|
3151
3607
|
this._element.removeChild(this._element.firstChild);
|
|
3152
3608
|
}
|
|
3609
|
+
|
|
3153
3610
|
this._error(this.elementType + " load aborted by the user.");
|
|
3154
3611
|
};
|
|
3612
|
+
|
|
3155
3613
|
MediaElementLoadStrategy.prototype._createElement = function () {
|
|
3156
3614
|
if (this.config.loadElement) return this.config.loadElement;else return document.createElement(this.elementType);
|
|
3157
3615
|
};
|
|
3616
|
+
|
|
3158
3617
|
MediaElementLoadStrategy.prototype._clearEvents = function () {
|
|
3159
3618
|
clearTimeout(this._elementTimer);
|
|
3619
|
+
|
|
3160
3620
|
this._element.removeEventListener('load', this._boundOnLoad, false);
|
|
3621
|
+
|
|
3161
3622
|
this._element.removeEventListener('canplaythrough', this._boundOnLoad, false);
|
|
3623
|
+
|
|
3162
3624
|
this._element.removeEventListener('error', this._boundOnError, false);
|
|
3163
3625
|
};
|
|
3626
|
+
|
|
3164
3627
|
MediaElementLoadStrategy.prototype._error = function (errMessage) {
|
|
3165
3628
|
this._clearEvents();
|
|
3629
|
+
|
|
3166
3630
|
this.onError.dispatch(errMessage);
|
|
3167
3631
|
};
|
|
3632
|
+
|
|
3168
3633
|
MediaElementLoadStrategy.prototype._complete = function () {
|
|
3169
3634
|
this._clearEvents();
|
|
3635
|
+
|
|
3170
3636
|
var resourceType = ResourceType.Unknown;
|
|
3637
|
+
|
|
3171
3638
|
switch (this.elementType) {
|
|
3172
3639
|
case 'audio':
|
|
3173
3640
|
resourceType = ResourceType.Audio;
|
|
3174
3641
|
break;
|
|
3642
|
+
|
|
3175
3643
|
case 'video':
|
|
3176
3644
|
resourceType = ResourceType.Video;
|
|
3177
3645
|
break;
|
|
3646
|
+
|
|
3178
3647
|
default:
|
|
3179
3648
|
assertNever(this.elementType);
|
|
3180
3649
|
}
|
|
3650
|
+
|
|
3181
3651
|
this.onComplete.dispatch(resourceType, this._element);
|
|
3182
3652
|
};
|
|
3653
|
+
|
|
3183
3654
|
MediaElementLoadStrategy.prototype._onLoad = function () {
|
|
3184
3655
|
this._complete();
|
|
3185
3656
|
};
|
|
3657
|
+
|
|
3186
3658
|
MediaElementLoadStrategy.prototype._onError = function () {
|
|
3187
3659
|
this._error(this.elementType + " failed to load.");
|
|
3188
3660
|
};
|
|
3661
|
+
|
|
3189
3662
|
MediaElementLoadStrategy.prototype._onTimeout = function () {
|
|
3190
3663
|
this._error(this.elementType + " load timed out.");
|
|
3191
3664
|
};
|
|
3665
|
+
|
|
3192
3666
|
return MediaElementLoadStrategy;
|
|
3193
3667
|
}(AbstractLoadStrategy);
|
|
3668
|
+
|
|
3194
3669
|
var AudioLoadStrategy = function (_super) {
|
|
3195
3670
|
__extends(AudioLoadStrategy, _super);
|
|
3671
|
+
|
|
3196
3672
|
function AudioLoadStrategy(config) {
|
|
3197
3673
|
return _super.call(this, config, 'audio') || this;
|
|
3198
3674
|
}
|
|
3675
|
+
|
|
3199
3676
|
return AudioLoadStrategy;
|
|
3200
3677
|
}(MediaElementLoadStrategy);
|
|
3678
|
+
|
|
3201
3679
|
var EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
|
|
3680
|
+
|
|
3202
3681
|
var ImageLoadStrategy = function (_super) {
|
|
3203
3682
|
__extends(ImageLoadStrategy, _super);
|
|
3683
|
+
|
|
3204
3684
|
function ImageLoadStrategy() {
|
|
3205
3685
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
3686
|
+
|
|
3206
3687
|
_this._boundOnLoad = _this._onLoad.bind(_this);
|
|
3207
3688
|
_this._boundOnError = _this._onError.bind(_this);
|
|
3208
3689
|
_this._boundOnTimeout = _this._onTimeout.bind(_this);
|
|
@@ -3210,55 +3691,79 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3210
3691
|
_this._elementTimer = 0;
|
|
3211
3692
|
return _this;
|
|
3212
3693
|
}
|
|
3694
|
+
|
|
3213
3695
|
ImageLoadStrategy.prototype.load = function () {
|
|
3214
3696
|
var config = this.config;
|
|
3215
3697
|
if (config.crossOrigin) this._element.crossOrigin = config.crossOrigin;
|
|
3216
3698
|
this._element.src = config.url;
|
|
3699
|
+
|
|
3217
3700
|
this._element.addEventListener('load', this._boundOnLoad, false);
|
|
3701
|
+
|
|
3218
3702
|
this._element.addEventListener('error', this._boundOnError, false);
|
|
3703
|
+
|
|
3219
3704
|
if (config.timeout) this._elementTimer = window.setTimeout(this._boundOnTimeout, config.timeout);
|
|
3220
3705
|
};
|
|
3706
|
+
|
|
3221
3707
|
ImageLoadStrategy.prototype.abort = function () {
|
|
3222
3708
|
this._clearEvents();
|
|
3709
|
+
|
|
3223
3710
|
this._element.src = EMPTY_GIF;
|
|
3711
|
+
|
|
3224
3712
|
this._error('Image load aborted by the user.');
|
|
3225
3713
|
};
|
|
3714
|
+
|
|
3226
3715
|
ImageLoadStrategy.prototype._createElement = function () {
|
|
3227
3716
|
if (this.config.loadElement) return this.config.loadElement;else return document.createElement('img');
|
|
3228
3717
|
};
|
|
3718
|
+
|
|
3229
3719
|
ImageLoadStrategy.prototype._clearEvents = function () {
|
|
3230
3720
|
clearTimeout(this._elementTimer);
|
|
3721
|
+
|
|
3231
3722
|
this._element.removeEventListener('load', this._boundOnLoad, false);
|
|
3723
|
+
|
|
3232
3724
|
this._element.removeEventListener('error', this._boundOnError, false);
|
|
3233
3725
|
};
|
|
3726
|
+
|
|
3234
3727
|
ImageLoadStrategy.prototype._error = function (errMessage) {
|
|
3235
3728
|
this._clearEvents();
|
|
3729
|
+
|
|
3236
3730
|
this.onError.dispatch(errMessage);
|
|
3237
3731
|
};
|
|
3732
|
+
|
|
3238
3733
|
ImageLoadStrategy.prototype._complete = function () {
|
|
3239
3734
|
this._clearEvents();
|
|
3735
|
+
|
|
3240
3736
|
this.onComplete.dispatch(ResourceType.Image, this._element);
|
|
3241
3737
|
};
|
|
3738
|
+
|
|
3242
3739
|
ImageLoadStrategy.prototype._onLoad = function () {
|
|
3243
3740
|
this._complete();
|
|
3244
3741
|
};
|
|
3742
|
+
|
|
3245
3743
|
ImageLoadStrategy.prototype._onError = function () {
|
|
3246
3744
|
this._error('Image failed to load.');
|
|
3247
3745
|
};
|
|
3746
|
+
|
|
3248
3747
|
ImageLoadStrategy.prototype._onTimeout = function () {
|
|
3249
3748
|
this._error('Image load timed out.');
|
|
3250
3749
|
};
|
|
3750
|
+
|
|
3251
3751
|
return ImageLoadStrategy;
|
|
3252
3752
|
}(AbstractLoadStrategy);
|
|
3753
|
+
|
|
3253
3754
|
var VideoLoadStrategy = function (_super) {
|
|
3254
3755
|
__extends(VideoLoadStrategy, _super);
|
|
3756
|
+
|
|
3255
3757
|
function VideoLoadStrategy(config) {
|
|
3256
3758
|
return _super.call(this, config, 'video') || this;
|
|
3257
3759
|
}
|
|
3760
|
+
|
|
3258
3761
|
return VideoLoadStrategy;
|
|
3259
3762
|
}(MediaElementLoadStrategy);
|
|
3763
|
+
|
|
3260
3764
|
var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest()));
|
|
3261
3765
|
var XhrResponseType;
|
|
3766
|
+
|
|
3262
3767
|
(function (XhrResponseType) {
|
|
3263
3768
|
XhrResponseType["Default"] = "text";
|
|
3264
3769
|
XhrResponseType["Buffer"] = "arraybuffer";
|
|
@@ -3267,13 +3772,17 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3267
3772
|
XhrResponseType["Json"] = "json";
|
|
3268
3773
|
XhrResponseType["Text"] = "text";
|
|
3269
3774
|
})(XhrResponseType || (XhrResponseType = {}));
|
|
3775
|
+
|
|
3270
3776
|
function reqType(xhr) {
|
|
3271
3777
|
return xhr.toString().replace('object ', '');
|
|
3272
3778
|
}
|
|
3779
|
+
|
|
3273
3780
|
var XhrLoadStrategy = function (_super) {
|
|
3274
3781
|
__extends(XhrLoadStrategy, _super);
|
|
3782
|
+
|
|
3275
3783
|
function XhrLoadStrategy() {
|
|
3276
3784
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
3785
|
+
|
|
3277
3786
|
_this._boundOnLoad = _this._onLoad.bind(_this);
|
|
3278
3787
|
_this._boundOnAbort = _this._onAbort.bind(_this);
|
|
3279
3788
|
_this._boundOnError = _this._onError.bind(_this);
|
|
@@ -3283,14 +3792,18 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3283
3792
|
_this._xhrType = XhrResponseType.Default;
|
|
3284
3793
|
return _this;
|
|
3285
3794
|
}
|
|
3795
|
+
|
|
3286
3796
|
XhrLoadStrategy.prototype.load = function () {
|
|
3287
3797
|
var config = this.config;
|
|
3288
3798
|
var ext = getExtension(config.url);
|
|
3799
|
+
|
|
3289
3800
|
if (typeof config.xhrType !== 'string') {
|
|
3290
3801
|
config.xhrType = this._determineXhrType(ext);
|
|
3291
3802
|
}
|
|
3803
|
+
|
|
3292
3804
|
var xhr = this._xhr;
|
|
3293
3805
|
this._xhrType = config.xhrType || XhrResponseType.Default;
|
|
3806
|
+
|
|
3294
3807
|
if (useXdr) {
|
|
3295
3808
|
xhr.timeout = config.timeout || 5000;
|
|
3296
3809
|
xhr.onload = this._boundOnLoad;
|
|
@@ -3313,21 +3826,27 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3313
3826
|
xhr.send();
|
|
3314
3827
|
}
|
|
3315
3828
|
};
|
|
3829
|
+
|
|
3316
3830
|
XhrLoadStrategy.prototype.abort = function () {
|
|
3317
3831
|
if (useXdr) {
|
|
3318
3832
|
this._clearEvents();
|
|
3833
|
+
|
|
3319
3834
|
this._xhr.abort();
|
|
3835
|
+
|
|
3320
3836
|
this._onAbort();
|
|
3321
3837
|
} else {
|
|
3322
3838
|
this._xhr.abort();
|
|
3323
3839
|
}
|
|
3324
3840
|
};
|
|
3841
|
+
|
|
3325
3842
|
XhrLoadStrategy.prototype._createRequest = function () {
|
|
3326
3843
|
if (useXdr) return new window.XDomainRequest();else return new XMLHttpRequest();
|
|
3327
3844
|
};
|
|
3845
|
+
|
|
3328
3846
|
XhrLoadStrategy.prototype._determineXhrType = function (ext) {
|
|
3329
3847
|
return XhrLoadStrategy._xhrTypeMap[ext] || XhrResponseType.Default;
|
|
3330
3848
|
};
|
|
3849
|
+
|
|
3331
3850
|
XhrLoadStrategy.prototype._clearEvents = function () {
|
|
3332
3851
|
if (useXdr) {
|
|
3333
3852
|
this._xhr.onload = null;
|
|
@@ -3336,103 +3855,142 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3336
3855
|
this._xhr.onprogress = null;
|
|
3337
3856
|
} else {
|
|
3338
3857
|
this._xhr.removeEventListener('load', this._boundOnLoad, false);
|
|
3858
|
+
|
|
3339
3859
|
this._xhr.removeEventListener('abort', this._boundOnAbort, false);
|
|
3860
|
+
|
|
3340
3861
|
this._xhr.removeEventListener('error', this._boundOnError, false);
|
|
3862
|
+
|
|
3341
3863
|
this._xhr.removeEventListener('timeout', this._boundOnTimeout, false);
|
|
3864
|
+
|
|
3342
3865
|
this._xhr.removeEventListener('progress', this._boundOnProgress, false);
|
|
3343
3866
|
}
|
|
3344
3867
|
};
|
|
3868
|
+
|
|
3345
3869
|
XhrLoadStrategy.prototype._error = function (errMessage) {
|
|
3346
3870
|
this._clearEvents();
|
|
3871
|
+
|
|
3347
3872
|
this.onError.dispatch(errMessage);
|
|
3348
3873
|
};
|
|
3874
|
+
|
|
3349
3875
|
XhrLoadStrategy.prototype._complete = function (type, data) {
|
|
3350
3876
|
this._clearEvents();
|
|
3877
|
+
|
|
3351
3878
|
this.onComplete.dispatch(type, data);
|
|
3352
3879
|
};
|
|
3880
|
+
|
|
3353
3881
|
XhrLoadStrategy.prototype._onLoad = function () {
|
|
3354
3882
|
var xhr = this._xhr;
|
|
3355
3883
|
var text = '';
|
|
3356
3884
|
var status = typeof xhr.status === 'undefined' ? 200 : xhr.status;
|
|
3885
|
+
|
|
3357
3886
|
if (typeof xhr.responseType === 'undefined' || xhr.responseType === '' || xhr.responseType === 'text') {
|
|
3358
3887
|
text = xhr.responseText;
|
|
3359
3888
|
}
|
|
3889
|
+
|
|
3360
3890
|
if (status === 0 && (text.length > 0 || xhr.responseType === XhrResponseType.Buffer)) {
|
|
3361
3891
|
status = 200;
|
|
3362
3892
|
} else if (status === 1223) {
|
|
3363
3893
|
status = 204;
|
|
3364
3894
|
}
|
|
3895
|
+
|
|
3365
3896
|
var flattenedStatus = Math.floor(status / 100) * 100;
|
|
3897
|
+
|
|
3366
3898
|
if (flattenedStatus !== 200) {
|
|
3367
3899
|
this._error("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL);
|
|
3900
|
+
|
|
3368
3901
|
return;
|
|
3369
3902
|
}
|
|
3903
|
+
|
|
3370
3904
|
switch (this._xhrType) {
|
|
3371
3905
|
case XhrResponseType.Buffer:
|
|
3372
3906
|
this._complete(ResourceType.Buffer, xhr.response);
|
|
3907
|
+
|
|
3373
3908
|
break;
|
|
3909
|
+
|
|
3374
3910
|
case XhrResponseType.Blob:
|
|
3375
3911
|
this._complete(ResourceType.Blob, xhr.response);
|
|
3912
|
+
|
|
3376
3913
|
break;
|
|
3914
|
+
|
|
3377
3915
|
case XhrResponseType.Document:
|
|
3378
3916
|
this._parseDocument(text);
|
|
3917
|
+
|
|
3379
3918
|
break;
|
|
3919
|
+
|
|
3380
3920
|
case XhrResponseType.Json:
|
|
3381
3921
|
this._parseJson(text);
|
|
3922
|
+
|
|
3382
3923
|
break;
|
|
3924
|
+
|
|
3383
3925
|
case XhrResponseType.Default:
|
|
3384
3926
|
case XhrResponseType.Text:
|
|
3385
3927
|
this._complete(ResourceType.Text, text);
|
|
3928
|
+
|
|
3386
3929
|
break;
|
|
3930
|
+
|
|
3387
3931
|
default:
|
|
3388
3932
|
assertNever(this._xhrType);
|
|
3389
3933
|
}
|
|
3390
3934
|
};
|
|
3935
|
+
|
|
3391
3936
|
XhrLoadStrategy.prototype._parseDocument = function (text) {
|
|
3392
3937
|
try {
|
|
3393
3938
|
if (window.DOMParser) {
|
|
3394
3939
|
var parser = new DOMParser();
|
|
3395
3940
|
var data = parser.parseFromString(text, 'text/xml');
|
|
3941
|
+
|
|
3396
3942
|
this._complete(ResourceType.Xml, data);
|
|
3397
3943
|
} else {
|
|
3398
3944
|
var div = document.createElement('div');
|
|
3399
3945
|
div.innerHTML = text;
|
|
3946
|
+
|
|
3400
3947
|
this._complete(ResourceType.Xml, div);
|
|
3401
3948
|
}
|
|
3402
3949
|
} catch (e) {
|
|
3403
3950
|
this._error("Error trying to parse loaded xml: " + e);
|
|
3404
3951
|
}
|
|
3405
3952
|
};
|
|
3953
|
+
|
|
3406
3954
|
XhrLoadStrategy.prototype._parseJson = function (text) {
|
|
3407
3955
|
try {
|
|
3408
3956
|
var data = JSON.parse(text);
|
|
3957
|
+
|
|
3409
3958
|
this._complete(ResourceType.Json, data);
|
|
3410
3959
|
} catch (e) {
|
|
3411
3960
|
this._error("Error trying to parse loaded json: " + e);
|
|
3412
3961
|
}
|
|
3413
3962
|
};
|
|
3963
|
+
|
|
3414
3964
|
XhrLoadStrategy.prototype._onAbort = function () {
|
|
3415
3965
|
var xhr = this._xhr;
|
|
3966
|
+
|
|
3416
3967
|
this._error(reqType(xhr) + " Request was aborted by the user.");
|
|
3417
3968
|
};
|
|
3969
|
+
|
|
3418
3970
|
XhrLoadStrategy.prototype._onError = function () {
|
|
3419
3971
|
var xhr = this._xhr;
|
|
3972
|
+
|
|
3420
3973
|
this._error(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\"");
|
|
3421
3974
|
};
|
|
3975
|
+
|
|
3422
3976
|
XhrLoadStrategy.prototype._onTimeout = function () {
|
|
3423
3977
|
var xhr = this._xhr;
|
|
3978
|
+
|
|
3424
3979
|
this._error(reqType(xhr) + " Request timed out.");
|
|
3425
3980
|
};
|
|
3981
|
+
|
|
3426
3982
|
XhrLoadStrategy.prototype._onProgress = function (event) {
|
|
3427
3983
|
if (event && event.lengthComputable) {
|
|
3428
3984
|
this.onProgress.dispatch(event.loaded / event.total);
|
|
3429
3985
|
}
|
|
3430
3986
|
};
|
|
3987
|
+
|
|
3431
3988
|
XhrLoadStrategy.setExtensionXhrType = function (extname, xhrType) {
|
|
3432
3989
|
if (extname && extname.indexOf('.') === 0) extname = extname.substring(1);
|
|
3433
3990
|
if (!extname) return;
|
|
3434
3991
|
XhrLoadStrategy._xhrTypeMap[extname] = xhrType;
|
|
3435
3992
|
};
|
|
3993
|
+
|
|
3436
3994
|
XhrLoadStrategy.ResponseType = XhrResponseType;
|
|
3437
3995
|
XhrLoadStrategy._xhrTypeMap = {
|
|
3438
3996
|
xhtml: XhrResponseType.Document,
|
|
@@ -3459,24 +4017,29 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3459
4017
|
};
|
|
3460
4018
|
return XhrLoadStrategy;
|
|
3461
4019
|
}(AbstractLoadStrategy);
|
|
4020
|
+
|
|
3462
4021
|
function onlyOnce(func) {
|
|
3463
4022
|
var fn = func;
|
|
3464
4023
|
return function onceWrapper() {
|
|
3465
4024
|
var args = [];
|
|
4025
|
+
|
|
3466
4026
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3467
4027
|
args[_i] = arguments[_i];
|
|
3468
4028
|
}
|
|
4029
|
+
|
|
3469
4030
|
if (fn === null) throw new Error('Callback was already called.');
|
|
3470
4031
|
var callFn = fn;
|
|
3471
4032
|
fn = null;
|
|
3472
4033
|
return callFn.apply(this, args);
|
|
3473
4034
|
};
|
|
3474
4035
|
}
|
|
4036
|
+
|
|
3475
4037
|
var AsyncQueue = function () {
|
|
3476
4038
|
function AsyncQueue(worker, concurrency) {
|
|
3477
4039
|
if (concurrency === void 0) {
|
|
3478
4040
|
concurrency = 1;
|
|
3479
4041
|
}
|
|
4042
|
+
|
|
3480
4043
|
this.worker = worker;
|
|
3481
4044
|
this.concurrency = concurrency;
|
|
3482
4045
|
this.workers = 0;
|
|
@@ -3492,6 +4055,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3492
4055
|
if (concurrency === 0) throw new Error('Concurrency must not be zero');
|
|
3493
4056
|
this.buffer = concurrency / 4;
|
|
3494
4057
|
}
|
|
4058
|
+
|
|
3495
4059
|
Object.defineProperty(AsyncQueue.prototype, "started", {
|
|
3496
4060
|
get: function get() {
|
|
3497
4061
|
return this._started;
|
|
@@ -3499,62 +4063,79 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3499
4063
|
enumerable: true,
|
|
3500
4064
|
configurable: true
|
|
3501
4065
|
});
|
|
4066
|
+
|
|
3502
4067
|
AsyncQueue.prototype.reset = function () {
|
|
3503
4068
|
this.onDrain.detachAll();
|
|
3504
4069
|
this.workers = 0;
|
|
3505
4070
|
this._started = false;
|
|
3506
4071
|
this._tasks = [];
|
|
3507
4072
|
};
|
|
4073
|
+
|
|
3508
4074
|
AsyncQueue.prototype.push = function (data, callback) {
|
|
3509
4075
|
this._insert(data, false, callback);
|
|
3510
4076
|
};
|
|
4077
|
+
|
|
3511
4078
|
AsyncQueue.prototype.unshift = function (data, callback) {
|
|
3512
4079
|
this._insert(data, true, callback);
|
|
3513
4080
|
};
|
|
4081
|
+
|
|
3514
4082
|
AsyncQueue.prototype.process = function () {
|
|
3515
4083
|
while (!this.paused && this.workers < this.concurrency && this._tasks.length) {
|
|
3516
4084
|
var task = this._tasks.shift();
|
|
4085
|
+
|
|
3517
4086
|
if (this._tasks.length === 0) this.onEmpty.dispatch();
|
|
3518
4087
|
this.workers += 1;
|
|
3519
4088
|
if (this.workers === this.concurrency) this.onSaturated.dispatch();
|
|
3520
4089
|
this.worker(task.data, onlyOnce(this._next(task)));
|
|
3521
4090
|
}
|
|
3522
4091
|
};
|
|
4092
|
+
|
|
3523
4093
|
AsyncQueue.prototype.length = function () {
|
|
3524
4094
|
return this._tasks.length;
|
|
3525
4095
|
};
|
|
4096
|
+
|
|
3526
4097
|
AsyncQueue.prototype.running = function () {
|
|
3527
4098
|
return this.workers;
|
|
3528
4099
|
};
|
|
4100
|
+
|
|
3529
4101
|
AsyncQueue.prototype.idle = function () {
|
|
3530
4102
|
return this._tasks.length + this.workers === 0;
|
|
3531
4103
|
};
|
|
4104
|
+
|
|
3532
4105
|
AsyncQueue.prototype.pause = function () {
|
|
3533
4106
|
if (this.paused === true) return;
|
|
3534
4107
|
this.paused = true;
|
|
3535
4108
|
};
|
|
4109
|
+
|
|
3536
4110
|
AsyncQueue.prototype.resume = function () {
|
|
3537
4111
|
if (this.paused === false) return;
|
|
3538
4112
|
this.paused = false;
|
|
4113
|
+
|
|
3539
4114
|
for (var w = 1; w <= this.concurrency; w++) {
|
|
3540
4115
|
this.process();
|
|
3541
4116
|
}
|
|
3542
4117
|
};
|
|
4118
|
+
|
|
3543
4119
|
AsyncQueue.prototype.getTask = function (index) {
|
|
3544
4120
|
return this._tasks[index];
|
|
3545
4121
|
};
|
|
4122
|
+
|
|
3546
4123
|
AsyncQueue.prototype._insert = function (data, insertAtFront, callback) {
|
|
3547
4124
|
var _this = this;
|
|
4125
|
+
|
|
3548
4126
|
if (callback != null && typeof callback !== 'function') {
|
|
3549
4127
|
throw new Error('task callback must be a function');
|
|
3550
4128
|
}
|
|
4129
|
+
|
|
3551
4130
|
this._started = true;
|
|
4131
|
+
|
|
3552
4132
|
if (data == null && this.idle()) {
|
|
3553
4133
|
setTimeout(function () {
|
|
3554
4134
|
return _this.onDrain.dispatch();
|
|
3555
4135
|
}, 1);
|
|
3556
4136
|
return;
|
|
3557
4137
|
}
|
|
4138
|
+
|
|
3558
4139
|
var task = {
|
|
3559
4140
|
data: data,
|
|
3560
4141
|
callback: callback
|
|
@@ -3564,23 +4145,30 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3564
4145
|
return _this.process();
|
|
3565
4146
|
}, 1);
|
|
3566
4147
|
};
|
|
4148
|
+
|
|
3567
4149
|
AsyncQueue.prototype._next = function (task) {
|
|
3568
4150
|
var _this = this;
|
|
4151
|
+
|
|
3569
4152
|
return function (err) {
|
|
3570
4153
|
var args = [];
|
|
4154
|
+
|
|
3571
4155
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3572
4156
|
args[_i - 1] = arguments[_i];
|
|
3573
4157
|
}
|
|
4158
|
+
|
|
3574
4159
|
_this.workers -= 1;
|
|
3575
4160
|
if (task.callback) task.callback.apply(task, __spreadArrays([err], args));
|
|
3576
4161
|
if (err) _this.onError.dispatch(err, task.data);
|
|
3577
4162
|
if (_this.workers <= _this.concurrency - _this.buffer) _this.onUnsaturated.dispatch();
|
|
3578
4163
|
if (_this.idle()) _this.onDrain.dispatch();
|
|
4164
|
+
|
|
3579
4165
|
_this.process();
|
|
3580
4166
|
};
|
|
3581
4167
|
};
|
|
4168
|
+
|
|
3582
4169
|
return AsyncQueue;
|
|
3583
4170
|
}();
|
|
4171
|
+
|
|
3584
4172
|
var Resource$1 = function () {
|
|
3585
4173
|
function Resource(name, options) {
|
|
3586
4174
|
this.children = [];
|
|
@@ -3592,12 +4180,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3592
4180
|
this.type = ResourceType.Unknown;
|
|
3593
4181
|
this.error = '';
|
|
3594
4182
|
this.progressChunk = 0;
|
|
4183
|
+
|
|
3595
4184
|
this._dequeue = function () {};
|
|
4185
|
+
|
|
3596
4186
|
this._onCompleteBinding = null;
|
|
3597
4187
|
this._state = ResourceState.NotStarted;
|
|
3598
4188
|
this.name = name;
|
|
3599
4189
|
this.metadata = options.metadata;
|
|
3600
4190
|
if (typeof options.crossOrigin !== 'string') options.crossOrigin = this._determineCrossOrigin(options.url);
|
|
4191
|
+
|
|
3601
4192
|
if (options.strategy && typeof options.strategy !== 'function') {
|
|
3602
4193
|
this._strategy = options.strategy;
|
|
3603
4194
|
this._strategy.config = options;
|
|
@@ -3607,18 +4198,24 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3607
4198
|
if (!StrategyCtor) StrategyCtor = Resource._defaultLoadStrategy;
|
|
3608
4199
|
this._strategy = new StrategyCtor(options);
|
|
3609
4200
|
}
|
|
4201
|
+
|
|
3610
4202
|
this._strategy.onError.add(this._error, this);
|
|
4203
|
+
|
|
3611
4204
|
this._strategy.onComplete.add(this._complete, this);
|
|
4205
|
+
|
|
3612
4206
|
this._strategy.onProgress.add(this._progress, this);
|
|
3613
4207
|
}
|
|
4208
|
+
|
|
3614
4209
|
Resource.setDefaultLoadStrategy = function (strategy) {
|
|
3615
4210
|
Resource._defaultLoadStrategy = strategy;
|
|
3616
4211
|
};
|
|
4212
|
+
|
|
3617
4213
|
Resource.setLoadStrategy = function (extname, strategy) {
|
|
3618
4214
|
if (extname && extname.indexOf('.') === 0) extname = extname.substring(1);
|
|
3619
4215
|
if (!extname) return;
|
|
3620
4216
|
Resource._loadStrategyMap[extname] = strategy;
|
|
3621
4217
|
};
|
|
4218
|
+
|
|
3622
4219
|
Object.defineProperty(Resource.prototype, "strategy", {
|
|
3623
4220
|
get: function get() {
|
|
3624
4221
|
return this._strategy;
|
|
@@ -3647,32 +4244,40 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3647
4244
|
enumerable: true,
|
|
3648
4245
|
configurable: true
|
|
3649
4246
|
});
|
|
4247
|
+
|
|
3650
4248
|
Resource.prototype.abort = function () {
|
|
3651
4249
|
this._strategy.abort();
|
|
3652
4250
|
};
|
|
4251
|
+
|
|
3653
4252
|
Resource.prototype.load = function () {
|
|
3654
4253
|
this._state = ResourceState.Loading;
|
|
3655
4254
|
this.onStart.dispatch(this);
|
|
4255
|
+
|
|
3656
4256
|
this._strategy.load();
|
|
3657
4257
|
};
|
|
4258
|
+
|
|
3658
4259
|
Resource.prototype._error = function (errMessage) {
|
|
3659
4260
|
this._state = ResourceState.Complete;
|
|
3660
4261
|
this.error = errMessage;
|
|
3661
4262
|
this.onComplete.dispatch(this);
|
|
3662
4263
|
};
|
|
4264
|
+
|
|
3663
4265
|
Resource.prototype._complete = function (type, data) {
|
|
3664
4266
|
this._state = ResourceState.Complete;
|
|
3665
4267
|
this.type = type;
|
|
3666
4268
|
this.data = data;
|
|
3667
4269
|
this.onComplete.dispatch(this);
|
|
3668
4270
|
};
|
|
4271
|
+
|
|
3669
4272
|
Resource.prototype._progress = function (percent) {
|
|
3670
4273
|
this.onProgress.dispatch(this, percent);
|
|
3671
4274
|
};
|
|
4275
|
+
|
|
3672
4276
|
Resource.prototype._determineCrossOrigin = function (url, loc) {
|
|
3673
4277
|
if (loc === void 0) {
|
|
3674
4278
|
loc = window.location;
|
|
3675
4279
|
}
|
|
4280
|
+
|
|
3676
4281
|
if (url.indexOf('data:') === 0 || url.indexOf('javascript:') === 0) return '';
|
|
3677
4282
|
if (window.origin !== window.location.origin) return 'anonymous';
|
|
3678
4283
|
if (!Resource._tempAnchor) Resource._tempAnchor = document.createElement('a');
|
|
@@ -3685,6 +4290,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3685
4290
|
if (parsed.host !== loc.hostname || !samePort || protocol !== loc.protocol) return 'anonymous';
|
|
3686
4291
|
return '';
|
|
3687
4292
|
};
|
|
4293
|
+
|
|
3688
4294
|
Resource._tempAnchor = null;
|
|
3689
4295
|
Resource._defaultLoadStrategy = XhrLoadStrategy;
|
|
3690
4296
|
Resource._loadStrategyMap = {
|
|
@@ -3708,32 +4314,40 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3708
4314
|
};
|
|
3709
4315
|
return Resource;
|
|
3710
4316
|
}();
|
|
4317
|
+
|
|
3711
4318
|
function eachSeries(array, iterator, callback, deferNext) {
|
|
3712
4319
|
if (deferNext === void 0) {
|
|
3713
4320
|
deferNext = false;
|
|
3714
4321
|
}
|
|
4322
|
+
|
|
3715
4323
|
var i = 0;
|
|
3716
4324
|
var len = array.length;
|
|
4325
|
+
|
|
3717
4326
|
(function next(err) {
|
|
3718
4327
|
if (err || i === len) {
|
|
3719
4328
|
if (callback) callback(err);
|
|
3720
4329
|
return;
|
|
3721
4330
|
}
|
|
4331
|
+
|
|
3722
4332
|
if (deferNext) setTimeout(function () {
|
|
3723
4333
|
return iterator(array[i++], next);
|
|
3724
4334
|
}, 1);else iterator(array[i++], next);
|
|
3725
4335
|
})();
|
|
3726
4336
|
}
|
|
4337
|
+
|
|
3727
4338
|
var MAX_PROGRESS = 100;
|
|
3728
4339
|
var rgxExtractUrlHash = /(#[\w-]+)?$/;
|
|
4340
|
+
|
|
3729
4341
|
var Loader = function () {
|
|
3730
4342
|
function Loader(baseUrl, concurrency) {
|
|
3731
4343
|
if (baseUrl === void 0) {
|
|
3732
4344
|
baseUrl = '';
|
|
3733
4345
|
}
|
|
4346
|
+
|
|
3734
4347
|
if (concurrency === void 0) {
|
|
3735
4348
|
concurrency = 10;
|
|
3736
4349
|
}
|
|
4350
|
+
|
|
3737
4351
|
this.progress = 0;
|
|
3738
4352
|
this.loading = false;
|
|
3739
4353
|
this.defaultQueryString = '';
|
|
@@ -3750,9 +4364,12 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3750
4364
|
this._boundLoadResource = this._loadResource.bind(this);
|
|
3751
4365
|
this.baseUrl = baseUrl;
|
|
3752
4366
|
this._queue = new AsyncQueue(this._boundLoadResource, concurrency);
|
|
4367
|
+
|
|
3753
4368
|
this._queue.pause();
|
|
4369
|
+
|
|
3754
4370
|
this._middleware = Loader._defaultMiddleware.slice();
|
|
3755
4371
|
}
|
|
4372
|
+
|
|
3756
4373
|
Object.defineProperty(Loader.prototype, "baseUrl", {
|
|
3757
4374
|
get: function get() {
|
|
3758
4375
|
return this._baseUrl;
|
|
@@ -3761,24 +4378,29 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3761
4378
|
while (url.length && url.charAt(url.length - 1) === '/') {
|
|
3762
4379
|
url = url.slice(0, -1);
|
|
3763
4380
|
}
|
|
4381
|
+
|
|
3764
4382
|
this._baseUrl = url;
|
|
3765
4383
|
},
|
|
3766
4384
|
enumerable: true,
|
|
3767
4385
|
configurable: true
|
|
3768
4386
|
});
|
|
4387
|
+
|
|
3769
4388
|
Loader.prototype.add = function (options, url_) {
|
|
3770
4389
|
if (Array.isArray(options)) {
|
|
3771
4390
|
for (var i = 0; i < options.length; ++i) {
|
|
3772
4391
|
this.add(options[i]);
|
|
3773
4392
|
}
|
|
4393
|
+
|
|
3774
4394
|
return this;
|
|
3775
4395
|
}
|
|
4396
|
+
|
|
3776
4397
|
var url = '';
|
|
3777
4398
|
var name = '';
|
|
3778
4399
|
var baseUrl = this._baseUrl;
|
|
3779
4400
|
var resOptions = {
|
|
3780
4401
|
url: ''
|
|
3781
4402
|
};
|
|
4403
|
+
|
|
3782
4404
|
if (typeof options === 'object') {
|
|
3783
4405
|
url = options.url;
|
|
3784
4406
|
name = options.name || options.url;
|
|
@@ -3788,84 +4410,114 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3788
4410
|
name = options;
|
|
3789
4411
|
if (typeof url_ === 'string') url = url_;else url = name;
|
|
3790
4412
|
}
|
|
4413
|
+
|
|
3791
4414
|
if (!url) throw new Error('You must specify the `url` property.');
|
|
4415
|
+
|
|
3792
4416
|
if (this.loading && !resOptions.parentResource) {
|
|
3793
4417
|
throw new Error('Cannot add root resources while the loader is running.');
|
|
3794
4418
|
}
|
|
4419
|
+
|
|
3795
4420
|
if (this.resources[name]) {
|
|
3796
4421
|
throw new Error("Resource named \"" + name + "\" already exists.");
|
|
3797
4422
|
}
|
|
4423
|
+
|
|
3798
4424
|
url = this._prepareUrl(url, baseUrl);
|
|
3799
4425
|
resOptions.url = url;
|
|
3800
4426
|
var resource = new Resource$1(name, resOptions);
|
|
3801
4427
|
this.resources[name] = resource;
|
|
4428
|
+
|
|
3802
4429
|
if (typeof resOptions.onComplete === 'function') {
|
|
3803
4430
|
resource.onAfterMiddleware.once(resOptions.onComplete);
|
|
3804
4431
|
}
|
|
4432
|
+
|
|
3805
4433
|
if (this.loading) {
|
|
3806
4434
|
var parent_1 = resOptions.parentResource;
|
|
3807
4435
|
var incompleteChildren = [];
|
|
4436
|
+
|
|
3808
4437
|
for (var i = 0; i < parent_1.children.length; ++i) {
|
|
3809
4438
|
if (!parent_1.children[i].isComplete) {
|
|
3810
4439
|
incompleteChildren.push(parent_1.children[i]);
|
|
3811
4440
|
}
|
|
3812
4441
|
}
|
|
4442
|
+
|
|
3813
4443
|
var fullChunk = parent_1.progressChunk * (incompleteChildren.length + 1);
|
|
3814
4444
|
var eachChunk = fullChunk / (incompleteChildren.length + 2);
|
|
3815
4445
|
parent_1.children.push(resource);
|
|
3816
4446
|
parent_1.progressChunk = eachChunk;
|
|
4447
|
+
|
|
3817
4448
|
for (var i = 0; i < incompleteChildren.length; ++i) {
|
|
3818
4449
|
incompleteChildren[i].progressChunk = eachChunk;
|
|
3819
4450
|
}
|
|
4451
|
+
|
|
3820
4452
|
resource.progressChunk = eachChunk;
|
|
3821
4453
|
}
|
|
4454
|
+
|
|
3822
4455
|
this._queue.push(resource);
|
|
4456
|
+
|
|
3823
4457
|
return this;
|
|
3824
4458
|
};
|
|
4459
|
+
|
|
3825
4460
|
Loader.prototype.use = function (fn, priority) {
|
|
3826
4461
|
if (priority === void 0) {
|
|
3827
4462
|
priority = Loader.DefaultMiddlewarePriority;
|
|
3828
4463
|
}
|
|
4464
|
+
|
|
3829
4465
|
this._middleware.push({
|
|
3830
4466
|
fn: fn,
|
|
3831
4467
|
priority: priority
|
|
3832
4468
|
});
|
|
4469
|
+
|
|
3833
4470
|
this._middleware.sort(function (a, b) {
|
|
3834
4471
|
return a.priority - b.priority;
|
|
3835
4472
|
});
|
|
4473
|
+
|
|
3836
4474
|
return this;
|
|
3837
4475
|
};
|
|
4476
|
+
|
|
3838
4477
|
Loader.prototype.reset = function () {
|
|
3839
4478
|
this.progress = 0;
|
|
3840
4479
|
this.loading = false;
|
|
4480
|
+
|
|
3841
4481
|
this._queue.reset();
|
|
4482
|
+
|
|
3842
4483
|
this._queue.pause();
|
|
4484
|
+
|
|
3843
4485
|
for (var k in this.resources) {
|
|
3844
4486
|
var res = this.resources[k];
|
|
3845
4487
|
if (!res) continue;
|
|
3846
4488
|
if (res._onCompleteBinding) res._onCompleteBinding.detach();
|
|
3847
4489
|
if (res.isLoading) res.abort();
|
|
3848
4490
|
}
|
|
4491
|
+
|
|
3849
4492
|
this.resources = {};
|
|
3850
4493
|
return this;
|
|
3851
4494
|
};
|
|
4495
|
+
|
|
3852
4496
|
Loader.prototype.load = function (cb) {
|
|
3853
4497
|
if (typeof cb === 'function') this.onComplete.once(cb);
|
|
3854
4498
|
if (this.loading) return this;
|
|
4499
|
+
|
|
3855
4500
|
if (this._queue.idle()) {
|
|
3856
4501
|
this._onStart();
|
|
4502
|
+
|
|
3857
4503
|
this._onComplete();
|
|
3858
4504
|
} else {
|
|
3859
4505
|
var numTasks = this._queue.length();
|
|
4506
|
+
|
|
3860
4507
|
var chunk = MAX_PROGRESS / numTasks;
|
|
4508
|
+
|
|
3861
4509
|
for (var i = 0; i < this._queue.length(); ++i) {
|
|
3862
4510
|
this._queue.getTask(i).data.progressChunk = chunk;
|
|
3863
4511
|
}
|
|
4512
|
+
|
|
3864
4513
|
this._onStart();
|
|
4514
|
+
|
|
3865
4515
|
this._queue.resume();
|
|
3866
4516
|
}
|
|
4517
|
+
|
|
3867
4518
|
return this;
|
|
3868
4519
|
};
|
|
4520
|
+
|
|
3869
4521
|
Object.defineProperty(Loader.prototype, "concurrency", {
|
|
3870
4522
|
get: function get() {
|
|
3871
4523
|
return this._queue.concurrency;
|
|
@@ -3876,25 +4528,32 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3876
4528
|
enumerable: true,
|
|
3877
4529
|
configurable: true
|
|
3878
4530
|
});
|
|
4531
|
+
|
|
3879
4532
|
Loader.prototype.addUrlResolver = function (func) {
|
|
3880
4533
|
this._urlResolvers.push(func);
|
|
4534
|
+
|
|
3881
4535
|
return this;
|
|
3882
4536
|
};
|
|
4537
|
+
|
|
3883
4538
|
Loader.prototype._prepareUrl = function (url, baseUrl) {
|
|
3884
4539
|
var parsed = parseUri(url, {
|
|
3885
4540
|
strictMode: true
|
|
3886
4541
|
});
|
|
4542
|
+
|
|
3887
4543
|
this._urlResolvers.forEach(function (resolver) {
|
|
3888
4544
|
url = resolver(url, parsed);
|
|
3889
4545
|
parsed = parseUri(url, {
|
|
3890
4546
|
strictMode: true
|
|
3891
4547
|
});
|
|
3892
4548
|
});
|
|
4549
|
+
|
|
3893
4550
|
if (!parsed.protocol && url.indexOf('//') !== 0) {
|
|
3894
4551
|
if (baseUrl.length && url.charAt(0) !== '/') url = baseUrl + "/" + url;else url = baseUrl + url;
|
|
3895
4552
|
}
|
|
4553
|
+
|
|
3896
4554
|
if (this.defaultQueryString) {
|
|
3897
4555
|
var match = rgxExtractUrlHash.exec(url);
|
|
4556
|
+
|
|
3898
4557
|
if (match) {
|
|
3899
4558
|
var hash = match[0];
|
|
3900
4559
|
url = url.substr(0, url.length - hash.length);
|
|
@@ -3902,90 +4561,121 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
3902
4561
|
url += hash;
|
|
3903
4562
|
}
|
|
3904
4563
|
}
|
|
4564
|
+
|
|
3905
4565
|
return url;
|
|
3906
4566
|
};
|
|
4567
|
+
|
|
3907
4568
|
Loader.prototype._loadResource = function (resource, dequeue) {
|
|
3908
4569
|
resource._dequeue = dequeue;
|
|
3909
4570
|
resource._onCompleteBinding = resource.onComplete.once(this._onLoad, this);
|
|
3910
4571
|
resource.load();
|
|
3911
4572
|
};
|
|
4573
|
+
|
|
3912
4574
|
Loader.prototype._onStart = function () {
|
|
3913
4575
|
this.progress = 0;
|
|
3914
4576
|
this.loading = true;
|
|
3915
4577
|
this.onStart.dispatch(this);
|
|
3916
4578
|
};
|
|
4579
|
+
|
|
3917
4580
|
Loader.prototype._onComplete = function () {
|
|
3918
4581
|
this.progress = MAX_PROGRESS;
|
|
3919
4582
|
this.loading = false;
|
|
3920
4583
|
this.onComplete.dispatch(this, this.resources);
|
|
3921
4584
|
};
|
|
4585
|
+
|
|
3922
4586
|
Loader.prototype._onLoad = function (resource) {
|
|
3923
4587
|
var _this = this;
|
|
4588
|
+
|
|
3924
4589
|
resource._onCompleteBinding = null;
|
|
4590
|
+
|
|
3925
4591
|
this._resourcesParsing.push(resource);
|
|
4592
|
+
|
|
3926
4593
|
resource._dequeue();
|
|
4594
|
+
|
|
3927
4595
|
eachSeries(this._middleware, function (middleware, next) {
|
|
3928
4596
|
middleware.fn.call(_this, resource, next);
|
|
3929
4597
|
}, function () {
|
|
3930
4598
|
resource.onAfterMiddleware.dispatch(resource);
|
|
3931
4599
|
_this.progress = Math.min(MAX_PROGRESS, _this.progress + resource.progressChunk);
|
|
4600
|
+
|
|
3932
4601
|
_this.onProgress.dispatch(_this, resource);
|
|
4602
|
+
|
|
3933
4603
|
if (resource.error) _this.onError.dispatch(resource.error, _this, resource);else _this.onLoad.dispatch(_this, resource);
|
|
4604
|
+
|
|
3934
4605
|
_this._resourcesParsing.splice(_this._resourcesParsing.indexOf(resource), 1);
|
|
4606
|
+
|
|
3935
4607
|
if (_this._queue.idle() && _this._resourcesParsing.length === 0) _this._onComplete();
|
|
3936
4608
|
}, true);
|
|
3937
4609
|
};
|
|
4610
|
+
|
|
3938
4611
|
Loader.use = function (fn, priority) {
|
|
3939
4612
|
if (priority === void 0) {
|
|
3940
4613
|
priority = Loader.DefaultMiddlewarePriority;
|
|
3941
4614
|
}
|
|
4615
|
+
|
|
3942
4616
|
Loader._defaultMiddleware.push({
|
|
3943
4617
|
fn: fn,
|
|
3944
4618
|
priority: priority
|
|
3945
4619
|
});
|
|
4620
|
+
|
|
3946
4621
|
Loader._defaultMiddleware.sort(function (a, b) {
|
|
3947
4622
|
return a.priority - b.priority;
|
|
3948
4623
|
});
|
|
4624
|
+
|
|
3949
4625
|
return Loader;
|
|
3950
4626
|
};
|
|
4627
|
+
|
|
3951
4628
|
Loader.DefaultMiddlewarePriority = 50;
|
|
3952
4629
|
Loader._defaultMiddleware = [];
|
|
3953
4630
|
return Loader;
|
|
3954
4631
|
}();
|
|
4632
|
+
|
|
3955
4633
|
var Progress = function (_super) {
|
|
3956
4634
|
__extends$1(Progress, _super);
|
|
4635
|
+
|
|
3957
4636
|
function Progress(_a) {
|
|
3958
4637
|
var resource = _a.resource,
|
|
3959
|
-
|
|
4638
|
+
resourceTotal = _a.resourceTotal;
|
|
4639
|
+
|
|
3960
4640
|
var _this = _super.call(this) || this;
|
|
4641
|
+
|
|
3961
4642
|
_this.progress = 0;
|
|
3962
4643
|
_this.resourceTotal = 0;
|
|
3963
4644
|
_this.resourceLoadedCount = 0;
|
|
3964
4645
|
_this.resource = resource;
|
|
3965
4646
|
_this.resourceTotal = resourceTotal;
|
|
4647
|
+
|
|
3966
4648
|
if (resourceTotal === 0) {
|
|
3967
4649
|
_this.resource.emit(exports.LOAD_EVENT.COMPLETE, _this);
|
|
3968
4650
|
}
|
|
4651
|
+
|
|
3969
4652
|
return _this;
|
|
3970
4653
|
}
|
|
4654
|
+
|
|
3971
4655
|
Progress.prototype.onStart = function () {
|
|
3972
4656
|
this.resource.emit(exports.LOAD_EVENT.START, this);
|
|
3973
4657
|
};
|
|
4658
|
+
|
|
3974
4659
|
Progress.prototype.onProgress = function (param) {
|
|
3975
4660
|
this.resourceLoadedCount++;
|
|
3976
4661
|
this.progress = Math.floor(this.resourceLoadedCount / this.resourceTotal * 100) / 100;
|
|
4662
|
+
|
|
3977
4663
|
if (param.success) {
|
|
3978
4664
|
this.resource.emit(exports.LOAD_EVENT.LOADED, this, param);
|
|
3979
4665
|
} else {
|
|
3980
4666
|
this.resource.emit(exports.LOAD_EVENT.ERROR, this, param);
|
|
3981
4667
|
}
|
|
4668
|
+
|
|
3982
4669
|
this.resource.emit(exports.LOAD_EVENT.PROGRESS, this, param);
|
|
4670
|
+
|
|
3983
4671
|
if (this.resourceLoadedCount === this.resourceTotal) {
|
|
3984
4672
|
this.resource.emit(exports.LOAD_EVENT.COMPLETE, this);
|
|
3985
4673
|
}
|
|
3986
4674
|
};
|
|
4675
|
+
|
|
3987
4676
|
return Progress;
|
|
3988
4677
|
}(EE);
|
|
4678
|
+
|
|
3989
4679
|
var Progress$1 = Progress;
|
|
3990
4680
|
var resourceLoader = {
|
|
3991
4681
|
AbstractLoadStrategy: AbstractLoadStrategy,
|
|
@@ -4001,6 +4691,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4001
4691
|
ResourceState: ResourceState
|
|
4002
4692
|
};
|
|
4003
4693
|
exports.LOAD_EVENT = void 0;
|
|
4694
|
+
|
|
4004
4695
|
(function (LOAD_EVENT) {
|
|
4005
4696
|
LOAD_EVENT["START"] = "start";
|
|
4006
4697
|
LOAD_EVENT["PROGRESS"] = "progress";
|
|
@@ -4008,7 +4699,9 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4008
4699
|
LOAD_EVENT["COMPLETE"] = "complete";
|
|
4009
4700
|
LOAD_EVENT["ERROR"] = "error";
|
|
4010
4701
|
})(exports.LOAD_EVENT || (exports.LOAD_EVENT = {}));
|
|
4702
|
+
|
|
4011
4703
|
exports.RESOURCE_TYPE = void 0;
|
|
4704
|
+
|
|
4012
4705
|
(function (RESOURCE_TYPE) {
|
|
4013
4706
|
RESOURCE_TYPE["IMAGE"] = "IMAGE";
|
|
4014
4707
|
RESOURCE_TYPE["SPRITE"] = "SPRITE";
|
|
@@ -4016,6 +4709,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4016
4709
|
RESOURCE_TYPE["AUDIO"] = "AUDIO";
|
|
4017
4710
|
RESOURCE_TYPE["VIDEO"] = "VIDEO";
|
|
4018
4711
|
})(exports.RESOURCE_TYPE || (exports.RESOURCE_TYPE = {}));
|
|
4712
|
+
|
|
4019
4713
|
XhrLoadStrategy.setExtensionXhrType('json', XhrResponseType.Json);
|
|
4020
4714
|
XhrLoadStrategy.setExtensionXhrType('tex', XhrResponseType.Json);
|
|
4021
4715
|
XhrLoadStrategy.setExtensionXhrType('ske', XhrResponseType.Json);
|
|
@@ -4034,10 +4728,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4034
4728
|
audio: XhrLoadStrategy,
|
|
4035
4729
|
video: VideoLoadStrategy
|
|
4036
4730
|
};
|
|
4731
|
+
|
|
4037
4732
|
var Resource = function (_super) {
|
|
4038
4733
|
__extends$1(Resource, _super);
|
|
4734
|
+
|
|
4039
4735
|
function Resource(options) {
|
|
4040
4736
|
var _this = _super.call(this) || this;
|
|
4737
|
+
|
|
4041
4738
|
_this.timeout = 6000;
|
|
4042
4739
|
_this.preProcessResourceHandlers = [];
|
|
4043
4740
|
_this.resourcesMap = {};
|
|
@@ -4045,32 +4742,41 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4045
4742
|
_this.destroyInstanceFunctions = {};
|
|
4046
4743
|
_this.promiseMap = {};
|
|
4047
4744
|
_this.loaders = [];
|
|
4745
|
+
|
|
4048
4746
|
if (options && typeof options.timeout === 'number') {
|
|
4049
4747
|
_this.timeout = options.timeout;
|
|
4050
4748
|
}
|
|
4749
|
+
|
|
4051
4750
|
return _this;
|
|
4052
4751
|
}
|
|
4752
|
+
|
|
4053
4753
|
Resource.prototype.loadConfig = function (resources) {
|
|
4054
4754
|
this.addResource(resources);
|
|
4055
4755
|
this.preload();
|
|
4056
4756
|
};
|
|
4757
|
+
|
|
4057
4758
|
Resource.prototype.loadSingle = function (resource) {
|
|
4058
4759
|
this.addResource([resource]);
|
|
4059
4760
|
return this.getResource(resource.name);
|
|
4060
4761
|
};
|
|
4762
|
+
|
|
4061
4763
|
Resource.prototype.addResource = function (resources) {
|
|
4062
4764
|
var e_1, _a;
|
|
4765
|
+
|
|
4063
4766
|
if (!resources || resources.length < 1) {
|
|
4064
4767
|
console.warn('no resources');
|
|
4065
4768
|
return;
|
|
4066
4769
|
}
|
|
4770
|
+
|
|
4067
4771
|
try {
|
|
4068
4772
|
for (var resources_1 = __values(resources), resources_1_1 = resources_1.next(); !resources_1_1.done; resources_1_1 = resources_1.next()) {
|
|
4069
4773
|
var res = resources_1_1.value;
|
|
4774
|
+
|
|
4070
4775
|
if (this.resourcesMap[res.name]) {
|
|
4071
4776
|
console.warn(res.name + ' was already added');
|
|
4072
4777
|
continue;
|
|
4073
4778
|
}
|
|
4779
|
+
|
|
4074
4780
|
this.resourcesMap[res.name] = res;
|
|
4075
4781
|
this.resourcesMap[res.name].data = {};
|
|
4076
4782
|
}
|
|
@@ -4086,20 +4792,26 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4086
4792
|
}
|
|
4087
4793
|
}
|
|
4088
4794
|
};
|
|
4795
|
+
|
|
4089
4796
|
Resource.prototype.addPreProcessResourceHandler = function (handler) {
|
|
4090
4797
|
this.preProcessResourceHandlers.push(handler);
|
|
4091
4798
|
};
|
|
4799
|
+
|
|
4092
4800
|
Resource.prototype.removePreProcessResourceHandler = function (handler) {
|
|
4093
4801
|
this.preProcessResourceHandlers.splice(this.preProcessResourceHandlers.indexOf(handler), 1);
|
|
4094
4802
|
};
|
|
4803
|
+
|
|
4095
4804
|
Resource.prototype.preload = function () {
|
|
4096
4805
|
var names = [];
|
|
4806
|
+
|
|
4097
4807
|
for (var key in this.resourcesMap) {
|
|
4098
4808
|
var resource_1 = this.resourcesMap[key];
|
|
4809
|
+
|
|
4099
4810
|
if (resource_1.preload && !resource_1.complete && !this.promiseMap[key]) {
|
|
4100
4811
|
names.push(resource_1.name);
|
|
4101
4812
|
}
|
|
4102
4813
|
}
|
|
4814
|
+
|
|
4103
4815
|
this.progress = new Progress$1({
|
|
4104
4816
|
resource: this,
|
|
4105
4817
|
resourceTotal: names.length
|
|
@@ -4109,6 +4821,7 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4109
4821
|
preload: true
|
|
4110
4822
|
});
|
|
4111
4823
|
};
|
|
4824
|
+
|
|
4112
4825
|
Resource.prototype.getResource = function (name) {
|
|
4113
4826
|
return __awaiter(this, void 0, void 0, function () {
|
|
4114
4827
|
return __generator(this, function (_a) {
|
|
@@ -4119,9 +4832,11 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4119
4832
|
});
|
|
4120
4833
|
});
|
|
4121
4834
|
};
|
|
4835
|
+
|
|
4122
4836
|
Resource.prototype.instance = function (name) {
|
|
4123
4837
|
return __awaiter(this, void 0, void 0, function () {
|
|
4124
4838
|
var res, _a;
|
|
4839
|
+
|
|
4125
4840
|
return __generator(this, function (_b) {
|
|
4126
4841
|
switch (_b.label) {
|
|
4127
4842
|
case 0:
|
|
@@ -4129,32 +4844,39 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4129
4844
|
_a = this.makeInstanceFunctions[res.type];
|
|
4130
4845
|
if (!_a) return [3, 2];
|
|
4131
4846
|
return [4, this.makeInstanceFunctions[res.type](res)];
|
|
4847
|
+
|
|
4132
4848
|
case 1:
|
|
4133
4849
|
_a = _b.sent();
|
|
4134
4850
|
_b.label = 2;
|
|
4851
|
+
|
|
4135
4852
|
case 2:
|
|
4136
4853
|
return [2, _a];
|
|
4137
4854
|
}
|
|
4138
4855
|
});
|
|
4139
4856
|
});
|
|
4140
4857
|
};
|
|
4858
|
+
|
|
4141
4859
|
Resource.prototype.destroy = function (name) {
|
|
4142
4860
|
return __awaiter(this, void 0, void 0, function () {
|
|
4143
4861
|
return __generator(this, function (_a) {
|
|
4144
4862
|
switch (_a.label) {
|
|
4145
4863
|
case 0:
|
|
4146
4864
|
return [4, this._destroy(name)];
|
|
4865
|
+
|
|
4147
4866
|
case 1:
|
|
4148
4867
|
_a.sent();
|
|
4868
|
+
|
|
4149
4869
|
return [2];
|
|
4150
4870
|
}
|
|
4151
4871
|
});
|
|
4152
4872
|
});
|
|
4153
4873
|
};
|
|
4874
|
+
|
|
4154
4875
|
Resource.prototype._destroy = function (name, loadError) {
|
|
4155
4876
|
if (loadError === void 0) {
|
|
4156
4877
|
loadError = false;
|
|
4157
4878
|
}
|
|
4879
|
+
|
|
4158
4880
|
return __awaiter(this, void 0, void 0, function () {
|
|
4159
4881
|
var resource, e_2;
|
|
4160
4882
|
return __generator(this, function (_a) {
|
|
@@ -4164,19 +4886,26 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4164
4886
|
if (!resource) return [2];
|
|
4165
4887
|
if (!!loadError) return [3, 5];
|
|
4166
4888
|
_a.label = 1;
|
|
4889
|
+
|
|
4167
4890
|
case 1:
|
|
4168
4891
|
_a.trys.push([1, 4,, 5]);
|
|
4892
|
+
|
|
4169
4893
|
if (!this.destroyInstanceFunctions[resource.type]) return [3, 3];
|
|
4170
4894
|
return [4, this.destroyInstanceFunctions[resource.type](resource)];
|
|
4895
|
+
|
|
4171
4896
|
case 2:
|
|
4172
4897
|
_a.sent();
|
|
4898
|
+
|
|
4173
4899
|
_a.label = 3;
|
|
4900
|
+
|
|
4174
4901
|
case 3:
|
|
4175
4902
|
return [3, 5];
|
|
4903
|
+
|
|
4176
4904
|
case 4:
|
|
4177
4905
|
e_2 = _a.sent();
|
|
4178
4906
|
console.warn("destroy resource " + resource.name + " error with '" + e_2.message + "'");
|
|
4179
4907
|
return [3, 5];
|
|
4908
|
+
|
|
4180
4909
|
case 5:
|
|
4181
4910
|
delete this.promiseMap[name];
|
|
4182
4911
|
resource.data = {};
|
|
@@ -4187,27 +4916,34 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4187
4916
|
});
|
|
4188
4917
|
});
|
|
4189
4918
|
};
|
|
4919
|
+
|
|
4190
4920
|
Resource.prototype.registerResourceType = function (type, value) {
|
|
4191
4921
|
if (value === void 0) {
|
|
4192
4922
|
value = type;
|
|
4193
4923
|
}
|
|
4924
|
+
|
|
4194
4925
|
if (exports.RESOURCE_TYPE[type]) {
|
|
4195
4926
|
throw new Error("The type " + type + " already exists in RESOURCE_TYPE");
|
|
4196
4927
|
}
|
|
4928
|
+
|
|
4197
4929
|
exports.RESOURCE_TYPE[type] = value;
|
|
4198
4930
|
};
|
|
4931
|
+
|
|
4199
4932
|
Resource.prototype.registerInstance = function (type, callback) {
|
|
4200
4933
|
this.makeInstanceFunctions[type] = callback;
|
|
4201
4934
|
};
|
|
4935
|
+
|
|
4202
4936
|
Resource.prototype.registerDestroy = function (type, callback) {
|
|
4203
4937
|
this.destroyInstanceFunctions[type] = callback;
|
|
4204
4938
|
};
|
|
4939
|
+
|
|
4205
4940
|
Resource.prototype.loadResource = function (_a) {
|
|
4206
4941
|
var _this = this;
|
|
4942
|
+
|
|
4207
4943
|
var _b = _a.names,
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4944
|
+
names = _b === void 0 ? [] : _b,
|
|
4945
|
+
_c = _a.preload,
|
|
4946
|
+
preload = _c === void 0 ? false : _c;
|
|
4211
4947
|
var unLoadNames = names.filter(function (name) {
|
|
4212
4948
|
return !_this.promiseMap[name] && _this.resourcesMap[name];
|
|
4213
4949
|
});
|
|
@@ -4216,10 +4952,12 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4216
4952
|
var loader = this.getLoader(preload);
|
|
4217
4953
|
unLoadNames.forEach(function (name) {
|
|
4218
4954
|
var e_3, _a;
|
|
4955
|
+
|
|
4219
4956
|
_this.promiseMap[name] = new Promise(function (r) {
|
|
4220
4957
|
return resolves[name] = r;
|
|
4221
4958
|
});
|
|
4222
4959
|
var res = _this.resourcesMap[name];
|
|
4960
|
+
|
|
4223
4961
|
try {
|
|
4224
4962
|
for (var _b = __values(_this.preProcessResourceHandlers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4225
4963
|
var handler = _c.value;
|
|
@@ -4236,10 +4974,13 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4236
4974
|
if (e_3) throw e_3.error;
|
|
4237
4975
|
}
|
|
4238
4976
|
}
|
|
4977
|
+
|
|
4239
4978
|
for (var key in res.src) {
|
|
4240
4979
|
var resourceType = res.src[key].type;
|
|
4980
|
+
|
|
4241
4981
|
if (resourceType === 'data') {
|
|
4242
4982
|
res.data[key] = res.src[key].data;
|
|
4983
|
+
|
|
4243
4984
|
_this.doComplete(name, resolves[name], preload);
|
|
4244
4985
|
} else {
|
|
4245
4986
|
loader.add({
|
|
@@ -4257,12 +4998,15 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4257
4998
|
});
|
|
4258
4999
|
loader.load();
|
|
4259
5000
|
};
|
|
5001
|
+
|
|
4260
5002
|
Resource.prototype.doComplete = function (name, resolve, preload) {
|
|
4261
5003
|
if (preload === void 0) {
|
|
4262
5004
|
preload = false;
|
|
4263
5005
|
}
|
|
5006
|
+
|
|
4264
5007
|
return __awaiter(this, void 0, void 0, function () {
|
|
4265
5008
|
var res, param, _a, err_1;
|
|
5009
|
+
|
|
4266
5010
|
return __generator(this, function (_b) {
|
|
4267
5011
|
switch (_b.label) {
|
|
4268
5012
|
case 0:
|
|
@@ -4274,59 +5018,75 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4274
5018
|
};
|
|
4275
5019
|
if (!this.checkAllLoaded(name)) return [3, 4];
|
|
4276
5020
|
_b.label = 1;
|
|
5021
|
+
|
|
4277
5022
|
case 1:
|
|
4278
5023
|
_b.trys.push([1, 3,, 4]);
|
|
5024
|
+
|
|
4279
5025
|
_a = res;
|
|
4280
5026
|
return [4, this.instance(name)];
|
|
5027
|
+
|
|
4281
5028
|
case 2:
|
|
4282
5029
|
_a.instance = _b.sent();
|
|
4283
5030
|
res.complete = true;
|
|
5031
|
+
|
|
4284
5032
|
if (preload) {
|
|
4285
5033
|
this.progress.onProgress(param);
|
|
4286
5034
|
}
|
|
5035
|
+
|
|
4287
5036
|
resolve(res);
|
|
4288
5037
|
return [3, 4];
|
|
5038
|
+
|
|
4289
5039
|
case 3:
|
|
4290
5040
|
err_1 = _b.sent();
|
|
4291
5041
|
console.error(err_1);
|
|
4292
5042
|
res.complete = false;
|
|
5043
|
+
|
|
4293
5044
|
if (preload) {
|
|
4294
5045
|
param.errMsg = err_1.message;
|
|
4295
5046
|
param.success = false;
|
|
4296
5047
|
this.progress.onProgress(param);
|
|
4297
5048
|
}
|
|
5049
|
+
|
|
4298
5050
|
resolve({});
|
|
4299
5051
|
return [3, 4];
|
|
5052
|
+
|
|
4300
5053
|
case 4:
|
|
4301
5054
|
return [2];
|
|
4302
5055
|
}
|
|
4303
5056
|
});
|
|
4304
5057
|
});
|
|
4305
5058
|
};
|
|
5059
|
+
|
|
4306
5060
|
Resource.prototype.checkAllLoaded = function (name) {
|
|
4307
5061
|
var res = this.resourcesMap[name];
|
|
4308
5062
|
return Array.from(Object.keys(res.src)).every(function (resourceKey) {
|
|
4309
5063
|
return res.data[resourceKey];
|
|
4310
5064
|
});
|
|
4311
5065
|
};
|
|
5066
|
+
|
|
4312
5067
|
Resource.prototype.getLoader = function (preload) {
|
|
4313
5068
|
var _this = this;
|
|
5069
|
+
|
|
4314
5070
|
if (preload === void 0) {
|
|
4315
5071
|
preload = false;
|
|
4316
5072
|
}
|
|
5073
|
+
|
|
4317
5074
|
var loader = this.loaders.find(function (_a) {
|
|
4318
5075
|
var loading = _a.loading;
|
|
4319
5076
|
return !loading;
|
|
4320
5077
|
});
|
|
5078
|
+
|
|
4321
5079
|
if (!loader) {
|
|
4322
5080
|
loader = new Loader();
|
|
4323
5081
|
this.loaders.push(loader);
|
|
4324
5082
|
}
|
|
5083
|
+
|
|
4325
5084
|
if (preload) {
|
|
4326
5085
|
loader.onStart.once(function () {
|
|
4327
5086
|
_this.progress.onStart();
|
|
4328
5087
|
});
|
|
4329
5088
|
}
|
|
5089
|
+
|
|
4330
5090
|
loader.onLoad.add(function (_, resource) {
|
|
4331
5091
|
_this.onLoad({
|
|
4332
5092
|
preload: preload,
|
|
@@ -4347,12 +5107,14 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4347
5107
|
});
|
|
4348
5108
|
return loader;
|
|
4349
5109
|
};
|
|
5110
|
+
|
|
4350
5111
|
Resource.prototype.onLoad = function (_a) {
|
|
4351
5112
|
var _b = _a.preload,
|
|
4352
|
-
|
|
4353
|
-
|
|
5113
|
+
preload = _b === void 0 ? false : _b,
|
|
5114
|
+
resource = _a.resource;
|
|
4354
5115
|
return __awaiter(this, void 0, void 0, function () {
|
|
4355
5116
|
var _c, key, name, resolves, data, res;
|
|
5117
|
+
|
|
4356
5118
|
return __generator(this, function (_d) {
|
|
4357
5119
|
_c = resource.metadata, key = _c.key, name = _c.name, resolves = _c.resolves, data = resource.data;
|
|
4358
5120
|
res = this.resourcesMap[name];
|
|
@@ -4362,17 +5124,22 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4362
5124
|
});
|
|
4363
5125
|
});
|
|
4364
5126
|
};
|
|
5127
|
+
|
|
4365
5128
|
Resource.prototype.onError = function (_a) {
|
|
4366
5129
|
var errMsg = _a.errMsg,
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
5130
|
+
_b = _a.preload,
|
|
5131
|
+
preload = _b === void 0 ? false : _b,
|
|
5132
|
+
resource = _a.resource;
|
|
4370
5133
|
return __awaiter(this, void 0, void 0, function () {
|
|
4371
5134
|
var _c, name, resolves, param;
|
|
5135
|
+
|
|
4372
5136
|
return __generator(this, function (_d) {
|
|
4373
5137
|
_c = resource.metadata, name = _c.name, resolves = _c.resolves;
|
|
5138
|
+
|
|
4374
5139
|
this._destroy(name, true);
|
|
5140
|
+
|
|
4375
5141
|
resolves[name]({});
|
|
5142
|
+
|
|
4376
5143
|
if (preload) {
|
|
4377
5144
|
param = {
|
|
4378
5145
|
name: name,
|
|
@@ -4382,18 +5149,21 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4382
5149
|
};
|
|
4383
5150
|
this.progress.onProgress(param);
|
|
4384
5151
|
}
|
|
5152
|
+
|
|
4385
5153
|
return [2];
|
|
4386
5154
|
});
|
|
4387
5155
|
});
|
|
4388
5156
|
};
|
|
5157
|
+
|
|
4389
5158
|
return Resource;
|
|
4390
5159
|
}(EE);
|
|
5160
|
+
|
|
4391
5161
|
var resource = new Resource();
|
|
4392
5162
|
var decorators = {
|
|
4393
5163
|
IDEProp: IDEProp,
|
|
4394
5164
|
componentObserver: componentObserver
|
|
4395
5165
|
};
|
|
4396
|
-
var version = '1.2.7-fix.
|
|
5166
|
+
var version = '1.2.7-fix.5';
|
|
4397
5167
|
console.log("Eva.js version: " + version);
|
|
4398
5168
|
exports.Component = Component$1;
|
|
4399
5169
|
exports.Game = Game$1;
|
|
@@ -4413,4 +5183,5 @@ var _EVA_IIFE_EVA = function (exports) {
|
|
|
4413
5183
|
});
|
|
4414
5184
|
return exports;
|
|
4415
5185
|
}({});
|
|
5186
|
+
|
|
4416
5187
|
window.EVA = window.EVA || _EVA_IIFE_EVA;
|