Socket
Socket
Sign inDemoInstall

next-tick

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.2 to 1.0.0

LICENSE

41

index.js

@@ -11,13 +11,25 @@ 'use strict';

byObserver = function (Observer) {
var node = document.createTextNode(''), queue, i = 0;
var node = document.createTextNode(''), queue, currentQueue, i = 0;
new Observer(function () {
var data;
if (!queue) return;
data = queue;
var callback;
if (!queue) {
if (!currentQueue) return;
queue = currentQueue;
} else if (currentQueue) {
queue = currentQueue.concat(queue);
}
currentQueue = queue;
queue = null;
if (typeof data === 'function') {
data();
if (typeof currentQueue === 'function') {
callback = currentQueue;
currentQueue = null;
callback();
return;
}
data.forEach(function (fn) { fn(); });
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 });

@@ -38,15 +50,10 @@ return function (fn) {

// Node.js
if ((typeof process !== 'undefined') && process &&
(typeof process.nextTick === 'function')) {
if ((typeof process === 'object') && process && (typeof process.nextTick === 'function')) {
return process.nextTick;
}
// MutationObserver=
// MutationObserver
if ((typeof document === 'object') && document) {
if (typeof MutationObserver === 'function') {
return byObserver(MutationObserver);
}
if (typeof WebKitMutationObserver === 'function') {
return byObserver(WebKitMutationObserver);
}
if (typeof MutationObserver === 'function') return byObserver(MutationObserver);
if (typeof WebKitMutationObserver === 'function') return byObserver(WebKitMutationObserver);
}

@@ -61,3 +68,3 @@

// Wide available standard
if (typeof setTimeout === 'function') {
if ((typeof setTimeout === 'function') || (typeof setTimeout === 'object')) {
return function (cb) { setTimeout(callable(cb), 0); };

@@ -64,0 +71,0 @@ }

{
"name": "next-tick",
"version": "0.2.2",
"version": "1.0.0",
"description": "Environment agnostic nextTick polyfill",
"author": "Mariusz Nowak <medykk@medikoo.com> (http://www.medikoo.com/)",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [

@@ -16,13 +16,13 @@ "nexttick",

},
"bugs": {
"email": "medikoo+next-tick@medikoo.com",
"url": "https://github.com/medikoo/next-tick/issues"
"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"
},
"devDependencies": {
"tad": "~0.1.21"
},
"license": "MIT"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc