fastman2 3.0.0-alpha.1 → 3.0.0-alpha.2

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/whenman.js CHANGED
@@ -1,774 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["fastman"] = factory();
8
- else
9
- root["fastman"] = factory();
10
- })(this, function() {
11
- return webpackJsonpfastman([6],{
12
-
13
- /***/ 0:
14
- /***/ (function(module, exports) {
15
-
16
- module.exports = function() {
17
- throw new Error("define cannot be used indirect");
18
- };
19
-
20
-
21
- /***/ }),
22
-
23
- /***/ 152:
24
- /***/ (function(module, exports, __webpack_require__) {
25
-
26
- "use strict";
27
- var __WEBPACK_AMD_DEFINE_RESULT__;
28
- /**
29
- * 文件用途说明 : asap队列核心模块
30
- *
31
- * 项目名称 : dfzq-obboot-mobi
32
- * 作者姓名 : crixusshen
33
- * 创建日期 : 16/4/3
34
- * 修改日期 : 16/4/3
35
- * 版权所有 : 东方证券股份有限公司
36
- **/
37
-
38
- (function (define) {
39
-
40
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
41
- // rawAsap provides everything we need except exception management.
42
- var rawAsap = __webpack_require__(154);
43
- // RawTasks are recycled to reduce GC churn.
44
- var freeTasks = [];
45
- // We queue errors to ensure they are thrown in right order (FIFO).
46
- // Array-as-queue is good enough here, since we are just dealing with exceptions.
47
- var pendingErrors = [];
48
- var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
49
-
50
- function throwFirstError() {
51
- if (pendingErrors.length) {
52
- throw pendingErrors.shift();
53
- }
54
- }
55
-
56
- /**
57
- * Calls a task as soon as possible after returning, in its own event, with priority
58
- * over other events like animation, reflow, and repaint. An error thrown from an
59
- * event will not interrupt, nor even substantially slow down the processing of
60
- * other events, but will be rather postponed to a lower priority event.
61
- * @param {{call}} task A callable object, typically a function that takes no
62
- * arguments.
63
- */
64
- //module.exports = asap;
65
- function asap(task) {
66
- var rawTask;
67
- if (freeTasks.length) {
68
- rawTask = freeTasks.pop();
69
- } else {
70
- rawTask = new RawTask();
71
- }
72
- rawTask.task = task;
73
- rawAsap(rawTask);
74
- }
75
-
76
- // We wrap tasks with recyclable task objects. A task object implements
77
- // `call`, just like a function.
78
- function RawTask() {
79
- this.task = null;
80
- }
81
-
82
- // The sole purpose of wrapping the task is to catch the exception and recycle
83
- // the task object after its single use.
84
- RawTask.prototype.call = function () {
85
- try {
86
- this.task.call();
87
- } catch (error) {
88
- if (asap.onerror) {
89
- // This hook exists purely for testing purposes.
90
- // Its name will be periodically randomized to break any code that
91
- // depends on its existence.
92
- asap.onerror(error);
93
- } else {
94
- // In a web browser, exceptions are not fatal. However, to avoid
95
- // slowing down the queue of pending tasks, we rethrow the error in a
96
- // lower priority turn.
97
- pendingErrors.push(error);
98
- requestErrorThrow();
99
- }
100
- } finally {
101
- this.task = null;
102
- freeTasks[freeTasks.length] = this;
103
- }
104
- };
105
-
106
- return asap;
107
- }.call(exports, __webpack_require__, exports, module),
108
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
109
- })(__webpack_require__(0)
110
- // Boilerplate for AMD and Node
111
- );
112
-
113
- /***/ }),
114
-
115
- /***/ 153:
116
- /***/ (function(module, exports, __webpack_require__) {
117
-
118
- "use strict";
119
- var __WEBPACK_AMD_DEFINE_RESULT__;
120
- /**
121
- * 文件用途说明 : promise+标准底层库
122
- *
123
- * 项目名称 : dfzq-obboot-mobi
124
- * 作者姓名 : crixusshen
125
- * 创建日期 : 16/4/3
126
- * 修改日期 : 16/4/3
127
- * 版权所有 : 东方证券股份有限公司
128
- **/
129
-
130
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
131
-
132
- (function (define) {
133
-
134
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
135
-
136
- var asap = __webpack_require__(152);
137
-
138
- function noop() {}
139
-
140
- // States:
141
- //
142
- // 0 - pending
143
- // 1 - fulfilled with _value
144
- // 2 - rejected with _value
145
- // 3 - adopted the state of another promise, _value
146
- //
147
- // once the state is no longer pending (0) it is immutable
148
-
149
- // All `_` prefixed properties will be reduced to `_{random number}`
150
- // at build time to obfuscate them and discourage their use.
151
- // We don't use symbols or Object.defineProperty to fully hide them
152
- // because the performance isn't good enough.
153
-
154
-
155
- // to avoid using try/catch inside critical functions, we
156
- // extract them to here.
157
- var LAST_ERROR = null;
158
- var IS_ERROR = {};
159
- function getThen(obj) {
160
- try {
161
- return obj.then;
162
- } catch (ex) {
163
- LAST_ERROR = ex;
164
- return IS_ERROR;
165
- }
166
- }
167
-
168
- function tryCallOne(fn, a) {
169
- try {
170
- return fn(a);
171
- } catch (ex) {
172
- LAST_ERROR = ex;
173
- return IS_ERROR;
174
- }
175
- }
176
- function tryCallTwo(fn, a, b) {
177
- try {
178
- fn(a, b);
179
- } catch (ex) {
180
- LAST_ERROR = ex;
181
- return IS_ERROR;
182
- }
183
- }
184
-
185
- function Promise(fn) {
186
- if (_typeof(this) !== 'object') {
187
- throw new TypeError('Promises must be constructed via new');
188
- }
189
- if (typeof fn !== 'function') {
190
- throw new TypeError('not a function');
191
- }
192
- // 0-不延迟 1-需要延迟
193
- this._deferredState = 0;
194
- // 0-初始化 1-resolve 2-reject
195
- this._state = 0;
196
- this._value = null;
197
- this._deferreds = null;
198
- if (fn === noop) return;
199
- doResolve(fn, this);
200
- }
201
- Promise._onHandle = null;
202
- Promise._onReject = null;
203
- Promise._noop = noop;
204
-
205
- Promise.prototype.then = function (onFulfilled, onRejected) {
206
- if (this.constructor !== Promise) {
207
- return safeThen(this, onFulfilled, onRejected);
208
- }
209
- var res = new Promise(noop);
210
- handle(this, new Handler(onFulfilled, onRejected, res));
211
- return res;
212
- };
213
-
214
- Promise.prototype.done = function (onFulfilled, onRejected) {
215
- var self = arguments.length ? this.then.apply(this, arguments) : this;
216
- self.then(null, function (err) {
217
- setTimeout(function () {
218
- throw err;
219
- }, 0);
220
- });
221
- };
222
-
223
- function safeThen(self, onFulfilled, onRejected) {
224
- return new self.constructor(function (resolve, reject) {
225
- var res = new Promise(noop);
226
- res.then(resolve, reject);
227
- handle(self, new Handler(onFulfilled, onRejected, res));
228
- });
229
- };
230
- function handle(self, deferred) {
231
- while (self._state === 3) {
232
- self = self._value;
233
- }
234
- if (Promise._onHandle) {
235
- Promise._onHandle(self);
236
- }
237
- if (self._state === 0) {
238
- if (self._deferredState === 0) {
239
- self._deferredState = 1;
240
- self._deferreds = deferred;
241
- return;
242
- }
243
- if (self._deferredState === 1) {
244
- self._deferredState = 2;
245
- self._deferreds = [self._deferreds, deferred];
246
- return;
247
- }
248
- self._deferreds.push(deferred);
249
- return;
250
- }
251
- handleResolved(self, deferred);
252
- }
253
-
254
- function handleResolved(self, deferred) {
255
- asap(function () {
256
- var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
257
- if (cb === null) {
258
- if (self._state === 1) {
259
- resolve(deferred.promise, self._value);
260
- } else {
261
- reject(deferred.promise, self._value);
262
- }
263
- return;
264
- }
265
- var ret = tryCallOne(cb, self._value);
266
- if (ret === IS_ERROR) {
267
- reject(deferred.promise, LAST_ERROR);
268
- } else {
269
- resolve(deferred.promise, ret);
270
- }
271
- });
272
- }
273
- function resolve(self, newValue) {
274
- // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
275
- if (newValue === self) {
276
- return reject(self, new TypeError('A promise cannot be resolved with itself.'));
277
- }
278
- if (newValue && ((typeof newValue === 'undefined' ? 'undefined' : _typeof(newValue)) === 'object' || typeof newValue === 'function')) {
279
- var then = getThen(newValue);
280
- if (then === IS_ERROR) {
281
- return reject(self, LAST_ERROR);
282
- }
283
- if (then === self.then && newValue instanceof Promise) {
284
- self._state = 3;
285
- self._value = newValue;
286
- finale(self);
287
- return;
288
- } else if (typeof then === 'function') {
289
- doResolve(then.bind(newValue), self);
290
- return;
291
- }
292
- }
293
- self._state = 1;
294
- self._value = newValue;
295
- finale(self);
296
- }
297
-
298
- function reject(self, newValue) {
299
- self._state = 2;
300
- self._value = newValue;
301
- if (Promise._onReject) {
302
- Promise._onReject(self, newValue);
303
- }
304
- finale(self);
305
- }
306
- function finale(self) {
307
- if (self._deferredState === 1) {
308
- handle(self, self._deferreds);
309
- self._deferreds = null;
310
- }
311
- if (self._deferredState === 2) {
312
- for (var i = 0; i < self._deferreds.length; i++) {
313
- handle(self, self._deferreds[i]);
314
- }
315
- self._deferreds = null;
316
- }
317
- }
318
-
319
- // One Defer
320
- function Handler(onFulfilled, onRejected, promise) {
321
- this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
322
- this.onRejected = typeof onRejected === 'function' ? onRejected : null;
323
- this.promise = promise;
324
- }
325
-
326
- /**
327
- * resolver处理
328
- * onFulfilled and onRejected只会被执行一次.
329
- *
330
- * 不保证会异步处理.
331
- */
332
- function doResolve(fn, promise) {
333
- var done = false;
334
- var res = tryCallTwo(fn,
335
- // resolve处理
336
- function (value) {
337
- if (done) return;
338
- done = true;
339
- resolve(promise, value);
340
- },
341
- // reject处理
342
- function (reason) {
343
- if (done) return;
344
- done = true;
345
- reject(promise, reason);
346
- });
347
- if (!done && res === IS_ERROR) {
348
- done = true;
349
- reject(promise, LAST_ERROR);
350
- }
351
- }
352
-
353
- return Promise;
354
- }.call(exports, __webpack_require__, exports, module),
355
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
356
- })(__webpack_require__(0)
357
- // Boilerplate for AMD and Node
358
- );
359
-
360
- /***/ }),
361
-
362
- /***/ 154:
363
- /***/ (function(module, exports, __webpack_require__) {
364
-
365
- "use strict";
366
- /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_RESULT__;
367
- /**
368
- * 文件用途说明 : asap队列模块
369
- *
370
- * 项目名称 : dfzq-obboot-mobi
371
- * 作者姓名 : crixusshen
372
- * 创建日期 : 16/4/3
373
- * 修改日期 : 16/4/3
374
- * 版权所有 : 东方证券股份有限公司
375
- **/
376
-
377
- (function (define) {
378
-
379
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
380
-
381
- "use strict";
382
-
383
- // Use the fastest means possible to execute a task in its own turn, with
384
- // priority over other events including IO, animation, reflow, and redraw
385
- // events in browsers.
386
- //
387
- // An exception thrown by a task will permanently interrupt the processing of
388
- // subsequent tasks. The higher level `asap` function ensures that if an
389
- // exception is thrown by a task, that the task queue will continue flushing as
390
- // soon as possible, but if you use `rawAsap` directly, you are responsible to
391
- // either ensure that no exceptions are thrown from your task, or to manually
392
- // call `rawAsap.requestFlush` if an exception is thrown.
393
- //module.exports = rawAsap;
394
-
395
- function rawAsap(task) {
396
- if (!queue.length) {
397
- requestFlush();
398
- flushing = true;
399
- }
400
- // Equivalent to push, but avoids a function call.
401
- queue[queue.length] = task;
402
- }
403
-
404
- var queue = [];
405
- // Once a flush has been requested, no further calls to `requestFlush` are
406
- // necessary until the next `flush` completes.
407
- var flushing = false;
408
- // `requestFlush` is an implementation-specific method that attempts to kick
409
- // off a `flush` event as quickly as possible. `flush` will attempt to exhaust
410
- // the event queue before yielding to the browser's own event loop.
411
- var requestFlush;
412
- // The position of the next task to execute in the task queue. This is
413
- // preserved between calls to `flush` so that it can be resumed if
414
- // a task throws an exception.
415
- var index = 0;
416
- // If a task schedules additional tasks recursively, the task queue can grow
417
- // unbounded. To prevent memory exhaustion, the task queue will periodically
418
- // truncate already-completed tasks.
419
- var capacity = 1024;
420
-
421
- // The flush function processes all tasks that have been scheduled with
422
- // `rawAsap` unless and until one of those tasks throws an exception.
423
- // If a task throws an exception, `flush` ensures that its state will remain
424
- // consistent and will resume where it left off when called again.
425
- // However, `flush` does not make any arrangements to be called again if an
426
- // exception is thrown.
427
- function flush() {
428
- while (index < queue.length) {
429
- var currentIndex = index;
430
- // Advance the index before calling the task. This ensures that we will
431
- // begin flushing on the next task the task throws an error.
432
- index = index + 1;
433
- queue[currentIndex].call();
434
- // Prevent leaking memory for long chains of recursive calls to `asap`.
435
- // If we call `asap` within tasks scheduled by `asap`, the queue will
436
- // grow, but to avoid an O(n) walk for every task we execute, we don't
437
- // shift tasks off the queue after they have been executed.
438
- // Instead, we periodically shift 1024 tasks off the queue.
439
- if (index > capacity) {
440
- // Manually shift all values starting at the index back to the
441
- // beginning of the queue.
442
- for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
443
- queue[scan] = queue[scan + index];
444
- }
445
- queue.length -= index;
446
- index = 0;
447
- }
448
- }
449
- queue.length = 0;
450
- index = 0;
451
- flushing = false;
452
- }
453
-
454
- // `requestFlush` is implemented using a strategy based on data collected from
455
- // every available SauceLabs Selenium web driver worker at time of writing.
456
- // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
457
-
458
- // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
459
- // have WebKitMutationObserver but not un-prefixed MutationObserver.
460
- // Must use `global` instead of `window` to work in both frames and web
461
- // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
462
- var global = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
463
- var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;
464
-
465
- // MutationObservers are desirable because they have high priority and work
466
- // reliably everywhere they are implemented.
467
- // They are implemented in all modern browsers.
468
- //
469
- // - Android 4-4.3
470
- // - Chrome 26-34
471
- // - Firefox 14-29
472
- // - Internet Explorer 11
473
- // - iPad Safari 6-7.1
474
- // - iPhone Safari 7-7.1
475
- // - Safari 6-7
476
- if (typeof BrowserMutationObserver === "function") {
477
- requestFlush = makeRequestCallFromMutationObserver(flush);
478
-
479
- // MessageChannels are desirable because they give direct access to the HTML
480
- // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
481
- // 11-12, and in web workers in many engines.
482
- // Although message channels yield to any queued rendering and IO tasks, they
483
- // would be better than imposing the 4ms delay of timers.
484
- // However, they do not work reliably in Internet Explorer or Safari.
485
-
486
- // Internet Explorer 10 is the only browser that has setImmediate but does
487
- // not have MutationObservers.
488
- // Although setImmediate yields to the browser's renderer, it would be
489
- // preferrable to falling back to setTimeout since it does not have
490
- // the minimum 4ms penalty.
491
- // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
492
- // Desktop to a lesser extent) that renders both setImmediate and
493
- // MessageChannel useless for the purposes of ASAP.
494
- // https://github.com/kriskowal/q/issues/396
495
-
496
- // Timers are implemented universally.
497
- // We fall back to timers in workers in most engines, and in foreground
498
- // contexts in the following browsers.
499
- // However, note that even this simple case requires nuances to operate in a
500
- // broad spectrum of browsers.
501
- //
502
- // - Firefox 3-13
503
- // - Internet Explorer 6-9
504
- // - iPad Safari 4.3
505
- // - Lynx 2.8.7
506
- } else {
507
- requestFlush = makeRequestCallFromTimer(flush);
508
- }
509
-
510
- // `requestFlush` requests that the high priority event queue be flushed as
511
- // soon as possible.
512
- // This is useful to prevent an error thrown in a task from stalling the event
513
- // queue if the exception handled by Node.js’s
514
- // `process.on("uncaughtException")` or by a domain.
515
- rawAsap.requestFlush = requestFlush;
516
-
517
- // To request a high priority event, we induce a mutation observer by toggling
518
- // the text of a text node between "1" and "-1".
519
- function makeRequestCallFromMutationObserver(callback) {
520
- var toggle = 1;
521
- var observer = new BrowserMutationObserver(callback);
522
- var node = document.createTextNode("");
523
- observer.observe(node, { characterData: true });
524
- return function requestCall() {
525
- toggle = -toggle;
526
- node.data = toggle;
527
- };
528
- }
529
-
530
- // The message channel technique was discovered by Malte Ubl and was the
531
- // original foundation for this library.
532
- // http://www.nonblocking.io/2011/06/windownexttick.html
533
-
534
- // Safari 6.0.5 (at least) intermittently fails to create message ports on a
535
- // page's first load. Thankfully, this version of Safari supports
536
- // MutationObservers, so we don't need to fall back in that case.
537
-
538
- // function makeRequestCallFromMessageChannel(callback) {
539
- // var channel = new MessageChannel();
540
- // channel.port1.onmessage = callback;
541
- // return function requestCall() {
542
- // channel.port2.postMessage(0);
543
- // };
544
- // }
545
-
546
- // For reasons explained above, we are also unable to use `setImmediate`
547
- // under any circumstances.
548
- // Even if we were, there is another bug in Internet Explorer 10.
549
- // It is not sufficient to assign `setImmediate` to `requestFlush` because
550
- // `setImmediate` must be called *by name* and therefore must be wrapped in a
551
- // closure.
552
- // Never forget.
553
-
554
- // function makeRequestCallFromSetImmediate(callback) {
555
- // return function requestCall() {
556
- // setImmediate(callback);
557
- // };
558
- // }
559
-
560
- // Safari 6.0 has a problem where timers will get lost while the user is
561
- // scrolling. This problem does not impact ASAP because Safari 6.0 supports
562
- // mutation observers, so that implementation is used instead.
563
- // However, if we ever elect to use timers in Safari, the prevalent work-around
564
- // is to add a scroll event listener that calls for a flush.
565
-
566
- // `setTimeout` does not call the passed callback if the delay is less than
567
- // approximately 7 in web workers in Firefox 8 through 18, and sometimes not
568
- // even then.
569
-
570
- function makeRequestCallFromTimer(callback) {
571
- return function requestCall() {
572
- // We dispatch a timeout with a specified delay of 0 for engines that
573
- // can reliably accommodate that request. This will usually be snapped
574
- // to a 4 milisecond delay, but once we're flushing, there's no delay
575
- // between events.
576
- var timeoutHandle = setTimeout(handleTimer, 0);
577
- // However, since this timer gets frequently dropped in Firefox
578
- // workers, we enlist an interval handle that will try to fire
579
- // an event 20 times per second until it succeeds.
580
- var intervalHandle = setInterval(handleTimer, 50);
581
-
582
- function handleTimer() {
583
- // Whichever timer succeeds will cancel both timers and
584
- // execute the callback.
585
- clearTimeout(timeoutHandle);
586
- clearInterval(intervalHandle);
587
- callback();
588
- }
589
- };
590
- }
591
-
592
- // This is for `asap.js` only.
593
- // Its name will be periodically randomized to break any code that depends on
594
- // its existence.
595
- rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
596
-
597
- // ASAP was originally a nextTick shim included in Q. This was factored out
598
- // into this ASAP package. It was later adapted to RSVP which made further
599
- // amendments. These decisions, particularly to marginalize MessageChannel and
600
- // to capture the MutationObserver implementation in a closure, were integrated
601
- // back into ASAP proper.
602
- // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
603
-
604
- return rawAsap;
605
- }.call(exports, __webpack_require__, exports, module),
606
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
607
- })(__webpack_require__(0)
608
- // Boilerplate for AMD and Node
609
- );
610
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
611
-
612
- /***/ }),
613
-
614
- /***/ 242:
615
- /***/ (function(module, exports, __webpack_require__) {
616
-
617
- module.exports = __webpack_require__(6);
618
-
619
-
620
- /***/ }),
621
-
622
- /***/ 6:
623
- /***/ (function(module, exports, __webpack_require__) {
624
-
625
- "use strict";
626
- var __WEBPACK_AMD_DEFINE_RESULT__;/*
627
- * @Author: shenzhiwei
628
- * @Date: 2017-04-17 08:53:38
629
- * @Company: orientsec.com.cn
630
- * @Description: promise-ES6 核心实现库
631
- */
632
-
633
-
634
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
635
-
636
- (function (define) {
637
-
638
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
639
-
640
- //This file contains the ES6 extensions to the core Promises/A+ API
641
-
642
- var Promise = __webpack_require__(153);
643
-
644
- /* Static Functions */
645
-
646
- var TRUE = valuePromise(true);
647
- var FALSE = valuePromise(false);
648
- var NULL = valuePromise(null);
649
- var UNDEFINED = valuePromise(undefined);
650
- var ZERO = valuePromise(0);
651
- var EMPTYSTRING = valuePromise('');
652
-
653
- function valuePromise(value) {
654
- var p = new Promise(Promise._noop);
655
- p._state = 1;
656
- p._value = value;
657
- return p;
658
- }
659
- Promise.resolve = function (value) {
660
- if (value instanceof Promise) return value;
661
-
662
- if (value === null) return NULL;
663
- if (value === undefined) return UNDEFINED;
664
- if (value === true) return TRUE;
665
- if (value === false) return FALSE;
666
- if (value === 0) return ZERO;
667
- if (value === '') return EMPTYSTRING;
668
-
669
- if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' || typeof value === 'function') {
670
- try {
671
- var then = value.then;
672
- if (typeof then === 'function') {
673
- return new Promise(then.bind(value));
674
- }
675
- } catch (ex) {
676
- return new Promise(function (resolve, reject) {
677
- reject(ex);
678
- });
679
- }
680
- }
681
- return valuePromise(value);
682
- };
683
-
684
- Promise.all = function (arr) {
685
- var args = Array.prototype.slice.call(arr);
686
-
687
- return new Promise(function (resolve, reject) {
688
- if (args.length === 0) return resolve([]);
689
- var remaining = args.length;
690
- function res(i, val) {
691
- if (val && ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' || typeof val === 'function')) {
692
- if (val instanceof Promise && val.then === Promise.prototype.then) {
693
- while (val._state === 3) {
694
- val = val._value;
695
- }
696
- if (val._state === 1) return res(i, val._value);
697
- if (val._state === 2) reject(val._value);
698
- val.then(function (val) {
699
- res(i, val);
700
- }, reject);
701
- return;
702
- } else {
703
- var then = val.then;
704
- if (typeof then === 'function') {
705
- var p = new Promise(then.bind(val));
706
- p.then(function (val) {
707
- res(i, val);
708
- }, reject);
709
- return;
710
- }
711
- }
712
- }
713
- args[i] = val;
714
- if (--remaining === 0) {
715
- resolve(args);
716
- }
717
- }
718
- for (var i = 0; i < args.length; i++) {
719
- res(i, args[i]);
720
- }
721
- });
722
- };
723
-
724
- Promise.reject = function (value) {
725
- return new Promise(function (resolve, reject) {
726
- reject(value);
727
- });
728
- };
729
-
730
- Promise.race = function (values) {
731
- return new Promise(function (resolve, reject) {
732
- values.forEach(function (value) {
733
- Promise.resolve(value).then(resolve, reject);
734
- });
735
- });
736
- };
737
-
738
- Promise.promise = function (fn) {
739
- return new Promise(fn);
740
- };
741
-
742
- Promise.attempt = function (fn) {
743
- for (var i = 0, l = arguments.length - 1, args = new Array(l); i < l; ++i) {
744
- args[i] = arguments[i + 1];
745
- }
746
-
747
- try {
748
- return this.resolve(fn.apply(this, args));
749
- } catch (e) {
750
- return this.reject(e);
751
- }
752
- };
753
-
754
- /* Prototype Methods */
755
-
756
- Promise.prototype['otherwise'] = function (onRejected) {
757
- return this.then(null, onRejected);
758
- };
759
-
760
- Promise.prototype['catch'] = function (onRejected) {
761
- return this.then(null, onRejected);
762
- };
763
-
764
- return Promise;
765
- }.call(exports, __webpack_require__, exports, module),
766
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
767
- })(__webpack_require__(0)
768
- // Boilerplate for AMD and Node
769
- );
770
-
771
- /***/ })
772
-
773
- },[242]);
774
- });
1
+ !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.fastman=n():t.fastman=n()}(this,function(){return webpackJsonpfastman([6],{0:function(t,n){t.exports=function(){throw new Error("define cannot be used indirect")}},152:function(t,n,e){"use strict";var r;!function(o){void 0!==(r=function(t){function n(){if(f.length)throw f.shift()}function r(t){var n;n=u.length?u.pop():new o,n.task=t,i(n)}function o(){this.task=null}var i=e(154),u=[],f=[],c=i.makeRequestCallFromTimer(n);return o.prototype.call=function(){try{this.task.call()}catch(t){r.onerror?r.onerror(t):(f.push(t),c())}finally{this.task=null,u[u.length]=this}},r}.call(n,e,n,t))&&(t.exports=r)}(e(0))},153:function(t,n,e){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(i){void 0!==(r=function(t){function n(){}function r(t){try{return t.then}catch(t){return _=t,m}}function i(t,n){try{return t(n)}catch(t){return _=t,m}}function u(t,n,e){try{t(n,e)}catch(t){return _=t,m}}function f(t){if("object"!==o(this))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._deferredState=0,this._state=0,this._value=null,this._deferreds=null,t!==n&&v(t,this)}function c(t,e,r){return new t.constructor(function(o,i){var u=new f(n);u.then(o,i),l(t,new h(e,r,u))})}function l(t,n){for(;3===t._state;)t=t._value;if(f._onHandle&&f._onHandle(t),0===t._state)return 0===t._deferredState?(t._deferredState=1,void(t._deferreds=n)):1===t._deferredState?(t._deferredState=2,void(t._deferreds=[t._deferreds,n])):void t._deferreds.push(n);a(t,n)}function a(t,n){y(function(){var e=1===t._state?n.onFulfilled:n.onRejected;if(null===e)return void(1===t._state?s(n.promise,t._value):d(n.promise,t._value));var r=i(e,t._value);r===m?d(n.promise,_):s(n.promise,r)})}function s(t,n){if(n===t)return d(t,new TypeError("A promise cannot be resolved with itself."));if(n&&("object"===(void 0===n?"undefined":o(n))||"function"==typeof n)){var e=r(n);if(e===m)return d(t,_);if(e===t.then&&n instanceof f)return t._state=3,t._value=n,void p(t);if("function"==typeof e)return void v(e.bind(n),t)}t._state=1,t._value=n,p(t)}function d(t,n){t._state=2,t._value=n,f._onReject&&f._onReject(t,n),p(t)}function p(t){if(1===t._deferredState&&(l(t,t._deferreds),t._deferreds=null),2===t._deferredState){for(var n=0;n<t._deferreds.length;n++)l(t,t._deferreds[n]);t._deferreds=null}}function h(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function v(t,n){var e=!1,r=u(t,function(t){e||(e=!0,s(n,t))},function(t){e||(e=!0,d(n,t))});e||r!==m||(e=!0,d(n,_))}var y=e(152),_=null,m={};return f._onHandle=null,f._onReject=null,f._noop=n,f.prototype.then=function(t,e){if(this.constructor!==f)return c(this,t,e);var r=new f(n);return l(this,new h(t,e,r)),r},f.prototype.done=function(t,n){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){setTimeout(function(){throw t},0)})},f}.call(n,e,n,t))&&(t.exports=r)}(e(0))},154:function(t,n,e){"use strict";(function(r){var o;!function(r){void 0!==(o=function(t){function n(t){i.length||(o(),u=!0),i[i.length]=t}function e(){for(;f<i.length;){var t=f;if(f+=1,i[t].call(),f>c){for(var n=0,e=i.length-f;n<e;n++)i[n]=i[n+f];i.length-=f,f=0}}i.length=0,f=0,u=!1}function r(t){return function(){function n(){clearTimeout(e),clearInterval(r),t()}var e=setTimeout(n,0),r=setInterval(n,50)}}var o,i=[],u=!1,f=0,c=1024,l=void 0!==l?l:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a=l.MutationObserver||l.WebKitMutationObserver;return o="function"==typeof a?function(t){var n=1,e=new a(t),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){n=-n,r.data=n}}(e):r(e),n.requestFlush=o,n.makeRequestCallFromTimer=r,n}.call(n,e,n,t))&&(t.exports=o)}(e(0))}).call(n,e(3))},242:function(t,n,e){t.exports=e(6)},6:function(t,n,e){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(i){void 0!==(r=function(t){function n(t){var n=new r(r._noop);return n._state=1,n._value=t,n}var r=e(153),i=n(!0),u=n(!1),f=n(null),c=n(void 0),l=n(0),a=n("");return r.resolve=function(t){if(t instanceof r)return t;if(null===t)return f;if(void 0===t)return c;if(!0===t)return i;if(!1===t)return u;if(0===t)return l;if(""===t)return a;if("object"===(void 0===t?"undefined":o(t))||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new r(e.bind(t))}catch(t){return new r(function(n,e){e(t)})}return n(t)},r.all=function(t){var n=Array.prototype.slice.call(t);return new r(function(t,e){function i(f,c){if(c&&("object"===(void 0===c?"undefined":o(c))||"function"==typeof c)){if(c instanceof r&&c.then===r.prototype.then){for(;3===c._state;)c=c._value;return 1===c._state?i(f,c._value):(2===c._state&&e(c._value),void c.then(function(t){i(f,t)},e))}var l=c.then;if("function"==typeof l){return void new r(l.bind(c)).then(function(t){i(f,t)},e)}}n[f]=c,0==--u&&t(n)}if(0===n.length)return t([]);for(var u=n.length,f=0;f<n.length;f++)i(f,n[f])})},r.reject=function(t){return new r(function(n,e){e(t)})},r.race=function(t){return new r(function(n,e){t.forEach(function(t){r.resolve(t).then(n,e)})})},r.promise=function(t){return new r(t)},r.attempt=function(t){for(var n=0,e=arguments.length-1,r=new Array(e);n<e;++n)r[n]=arguments[n+1];try{return this.resolve(t.apply(this,r))}catch(t){return this.reject(t)}},r.prototype.otherwise=function(t){return this.then(null,t)},r.prototype.catch=function(t){return this.then(null,t)},r}.call(n,e,n,t))&&(t.exports=r)}(e(0))}},[242])});