aboutsummaryrefslogtreecommitdiff
path: root/node_modules/next-tick
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/next-tick
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/next-tick')
-rw-r--r--node_modules/next-tick/.lint14
-rw-r--r--node_modules/next-tick/.npmignore4
-rw-r--r--node_modules/next-tick/.travis.yml16
-rw-r--r--node_modules/next-tick/CHANGES24
-rw-r--r--node_modules/next-tick/LICENSE21
-rw-r--r--node_modules/next-tick/README.md24
-rw-r--r--node_modules/next-tick/index.js71
-rw-r--r--node_modules/next-tick/package.json27
-rw-r--r--node_modules/next-tick/test/index.js22
9 files changed, 223 insertions, 0 deletions
diff --git a/node_modules/next-tick/.lint b/node_modules/next-tick/.lint
new file mode 100644
index 00000000..7f0f7f0c
--- /dev/null
+++ b/node_modules/next-tick/.lint
@@ -0,0 +1,14 @@
+@root
+
+module
+es5
+
+indent 2
+maxlen 100
+tabs
+
+ass
+bitwise
+nomen
+plusplus
+predef+ process, setImmediate, setTimeout, clearTimeout, document, MutationObserver, WebKitMutationObserver
diff --git a/node_modules/next-tick/.npmignore b/node_modules/next-tick/.npmignore
new file mode 100644
index 00000000..155e41f6
--- /dev/null
+++ b/node_modules/next-tick/.npmignore
@@ -0,0 +1,4 @@
+.DS_Store
+/node_modules
+/npm-debug.log
+/.lintcache
diff --git a/node_modules/next-tick/.travis.yml b/node_modules/next-tick/.travis.yml
new file mode 100644
index 00000000..d867be5f
--- /dev/null
+++ b/node_modules/next-tick/.travis.yml
@@ -0,0 +1,16 @@
+sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
+language: node_js
+node_js:
+ - 0.12
+ - 4
+ - 5
+ - 6
+
+before_install:
+ - mkdir node_modules; ln -s ../ node_modules/next-tick
+
+notifications:
+ email:
+ - medikoo+next-tick@medikoo.com
+
+script: "npm test && npm run lint"
diff --git a/node_modules/next-tick/CHANGES b/node_modules/next-tick/CHANGES
new file mode 100644
index 00000000..6f59c887
--- /dev/null
+++ b/node_modules/next-tick/CHANGES
@@ -0,0 +1,24 @@
+v1.0.0 -- 2016.06.09
+* In case MutationObserver based solution ensure all callbacks are propagated
+ even if any on the way crashes (fixes #3)
+* Support older engines (as IE8) which see typeof setTimeout as 'object'
+* Fix spelling of LICENSE
+* Configure lint scripts
+
+v0.2.2 -- 2014.04.18
+- Do not rely on es5-ext's valid-callable. Replace it with simple internal function
+- In MutationObserver fallback rely on text node instead of attribute and assure
+ mutation event is invoked by real change of data
+
+v0.2.1 -- 2014.02.24
+- Fix case in import path
+
+v0.2.0 -- 2014.02.24
+- Assure microtask resultion if MutationObserver is available (thanks @Raynos) #1
+- Unify validation of callback. TypeError is throw for any non callable input
+- Move main module from `lib` to root directory
+- Improve documentation
+- Remove Makefile (it's environment agnostic pacakge)
+
+v0.1.0 -- 2012.08.29
+Initial
diff --git a/node_modules/next-tick/LICENSE b/node_modules/next-tick/LICENSE
new file mode 100644
index 00000000..fa5fffdd
--- /dev/null
+++ b/node_modules/next-tick/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (C) 2012-2016 Mariusz Nowak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/next-tick/README.md b/node_modules/next-tick/README.md
new file mode 100644
index 00000000..5e73a8b7
--- /dev/null
+++ b/node_modules/next-tick/README.md
@@ -0,0 +1,24 @@
+# next-tick
+## Environment agnostic nextTick polyfill
+
+To be used in environment agnostic modules that need nextTick functionality.
+
+- When run in Node.js `process.nextTick` is used
+- In modern browsers microtask resolution is guaranteed by `MutationObserver`
+- In other engines `setImmediate` or `setTimeout(fn, 0)` is used as fallback.
+- If none of the above is supported module resolves to `null`
+
+## Installation
+### NPM
+
+In your project path:
+
+ $ npm install next-tick
+
+#### Browser
+
+You can easily bundle `next-tick` for browser with any CJS bundler, e.g. [modules-webmake](https://github.com/medikoo/modules-webmake)
+
+## Tests [![Build Status](https://api.travis-ci.org/medikoo/next-tick.png?branch=master)](https://travis-ci.org/medikoo/next-tick)
+
+ $ npm test
diff --git a/node_modules/next-tick/index.js b/node_modules/next-tick/index.js
new file mode 100644
index 00000000..ec2138ed
--- /dev/null
+++ b/node_modules/next-tick/index.js
@@ -0,0 +1,71 @@
+'use strict';
+
+var callable, byObserver;
+
+callable = function (fn) {
+ if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
+ return fn;
+};
+
+byObserver = function (Observer) {
+ var node = document.createTextNode(''), queue, currentQueue, i = 0;
+ new Observer(function () {
+ var callback;
+ if (!queue) {
+ if (!currentQueue) return;
+ queue = currentQueue;
+ } else if (currentQueue) {
+ queue = currentQueue.concat(queue);
+ }
+ currentQueue = queue;
+ queue = null;
+ if (typeof currentQueue === 'function') {
+ callback = currentQueue;
+ currentQueue = null;
+ callback();
+ return;
+ }
+ node.data = (i = ++i % 2); // Invoke other batch, to handle leftover callbacks in case of crash
+ while (currentQueue) {
+ callback = currentQueue.shift();
+ if (!currentQueue.length) currentQueue = null;
+ callback();
+ }
+ }).observe(node, { characterData: true });
+ return function (fn) {
+ callable(fn);
+ if (queue) {
+ if (typeof queue === 'function') queue = [queue, fn];
+ else queue.push(fn);
+ return;
+ }
+ queue = fn;
+ node.data = (i = ++i % 2);
+ };
+};
+
+module.exports = (function () {
+ // Node.js
+ if ((typeof process === 'object') && process && (typeof process.nextTick === 'function')) {
+ return process.nextTick;
+ }
+
+ // MutationObserver
+ if ((typeof document === 'object') && document) {
+ if (typeof MutationObserver === 'function') return byObserver(MutationObserver);
+ if (typeof WebKitMutationObserver === 'function') return byObserver(WebKitMutationObserver);
+ }
+
+ // W3C Draft
+ // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html
+ if (typeof setImmediate === 'function') {
+ return function (cb) { setImmediate(callable(cb)); };
+ }
+
+ // Wide available standard
+ if ((typeof setTimeout === 'function') || (typeof setTimeout === 'object')) {
+ return function (cb) { setTimeout(callable(cb), 0); };
+ }
+
+ return null;
+}());
diff --git a/node_modules/next-tick/package.json b/node_modules/next-tick/package.json
new file mode 100644
index 00000000..752ba2ea
--- /dev/null
+++ b/node_modules/next-tick/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "next-tick",
+ "version": "1.0.0",
+ "description": "Environment agnostic nextTick polyfill",
+ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
+ "keywords": [
+ "nexttick",
+ "setImmediate",
+ "setTimeout",
+ "async"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/medikoo/next-tick.git"
+ },
+ "devDependencies": {
+ "tad": "^0.2.4",
+ "xlint": "^0.2.2",
+ "xlint-jslint-medikoo": "^0.1.4"
+ },
+ "scripts": {
+ "lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
+ "lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
+ "test": "node node_modules/tad/bin/tad"
+ },
+ "license": "MIT"
+}
diff --git a/node_modules/next-tick/test/index.js b/node_modules/next-tick/test/index.js
new file mode 100644
index 00000000..6b22cf48
--- /dev/null
+++ b/node_modules/next-tick/test/index.js
@@ -0,0 +1,22 @@
+'use strict';
+
+module.exports = function (t, a, d) {
+ var invoked;
+
+ a(t(function () {
+ a(arguments.length, 0, "Arguments");
+ invoked = true;
+ }), undefined, "Return");
+ a(invoked, undefined, "Is not run immediately");
+ setTimeout(function () {
+ a(invoked, true, "Run in next tick");
+ invoked = [];
+ t(function () { invoked.push(0); });
+ t(function () { invoked.push(1); });
+ t(function () { invoked.push(2); });
+ setTimeout(function () {
+ a.deep(invoked, [0, 1, 2], "Serial");
+ d();
+ }, 10);
+ }, 10);
+};