1 |
|
2 |
|
3 |
|
4 |
|
5 | (function(define) { 'use strict';
|
6 | define(function(require) {
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var nextTick, MutationObs;
|
15 |
|
16 | if (typeof process !== 'undefined' && process !== null &&
|
17 | typeof process.nextTick === 'function') {
|
18 | nextTick = function(f) {
|
19 | process.nextTick(f);
|
20 | };
|
21 |
|
22 | } else if (MutationObs =
|
23 | (typeof MutationObserver === 'function' && MutationObserver) ||
|
24 | (typeof WebKitMutationObserver === 'function' && WebKitMutationObserver)) {
|
25 | nextTick = (function (document, MutationObserver) {
|
26 | var scheduled;
|
27 | var el = document.createElement('div');
|
28 | var o = new MutationObserver(run);
|
29 | o.observe(el, { attributes: true });
|
30 |
|
31 | function run() {
|
32 | var f = scheduled;
|
33 | scheduled = void 0;
|
34 | f();
|
35 | }
|
36 |
|
37 | return function (f) {
|
38 | scheduled = f;
|
39 | el.setAttribute('class', 'x');
|
40 | };
|
41 | }(document, MutationObs));
|
42 |
|
43 | } else {
|
44 | nextTick = (function(cjsRequire) {
|
45 | try {
|
46 |
|
47 | return cjsRequire('vertx').runOnLoop || cjsRequire('vertx').runOnContext;
|
48 | } catch (ignore) {}
|
49 |
|
50 |
|
51 |
|
52 | var capturedSetTimeout = setTimeout;
|
53 | return function (t) {
|
54 | capturedSetTimeout(t, 0);
|
55 | };
|
56 | }(require));
|
57 | }
|
58 |
|
59 | return nextTick;
|
60 | });
|
61 | }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));
|