Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immediate

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immediate - npm Package Compare versions

Comparing version 2.4.3 to 2.5.0

4

bower.json
{
"name": "immediate",
"version": "2.4.3",
"homepage": "https://github.com/calvinmetcalf/setImmediate",
"homepage": "https://github.com/calvinmetcalf/immediate",
"authors": [

@@ -9,3 +9,3 @@ "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",

"Yaffle",
"Calvin Metcalf <calvin.metcalf@state.ma.us>"
"Calvin Metcalf <calvin.metcalf@gmail.com>"
],

@@ -12,0 +12,0 @@ "main": "dist/immediate.js",

{
"name": "immediate",
"repo": "calvinmetcalf/setImmediate",
"description": "A shim for the setImmediate efficient script yielding API",
"version": "2.4.3",
"repo": "calvinmetcalf/immediate",
"description": "A polyfill for the setImmediate efficient script yielding API",
"version": "2.5.0",
"keywords": [],
"development": {},
"license": "MIT",
"main": "lib/index.js",
"main": "dist/immediate.js",
"scripts": [
"lib/index.js",
"lib/nextTick.js",
"lib/postMessage.js",
"lib/messageChannel.js",
"lib/stateChange.js",
"lib/timeout.js",
"lib/global.js",
"lib/mutation.js",
"lib/realSetImmediate.js"
dist/immediate.js
]
}

@@ -1,200 +0,5 @@

;(function(){
/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/
function require(path, parent, orig) {
var resolved = require.resolve(path);
// lookup failed
if (null == resolved) {
orig = orig || path;
parent = parent || 'root';
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
err.path = orig;
err.parent = parent;
err.require = true;
throw err;
}
var module = require.modules[resolved];
// perform real require()
// by invoking the module's
// registered function
if (!module.exports) {
module.exports = {};
module.client = module.component = true;
module.call(this, module.exports, require.relative(resolved), module);
}
return module.exports;
}
/**
* Registered modules.
*/
require.modules = {};
/**
* Registered aliases.
*/
require.aliases = {};
/**
* Resolve `path`.
*
* Lookup:
*
* - PATH/index.js
* - PATH.js
* - PATH
*
* @param {String} path
* @return {String} path or null
* @api private
*/
require.resolve = function(path) {
if (path.charAt(0) === '/') path = path.slice(1);
var paths = [
path,
path + '.js',
path + '.json',
path + '/index.js',
path + '/index.json'
];
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
if (require.modules.hasOwnProperty(path)) return path;
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
}
};
/**
* Normalize `path` relative to the current path.
*
* @param {String} curr
* @param {String} path
* @return {String}
* @api private
*/
require.normalize = function(curr, path) {
var segs = [];
if ('.' != path.charAt(0)) return path;
curr = curr.split('/');
path = path.split('/');
for (var i = 0; i < path.length; ++i) {
if ('..' == path[i]) {
curr.pop();
} else if ('.' != path[i] && '' != path[i]) {
segs.push(path[i]);
}
}
return curr.concat(segs).join('/');
};
/**
* Register module at `path` with callback `definition`.
*
* @param {String} path
* @param {Function} definition
* @api private
*/
require.register = function(path, definition) {
require.modules[path] = definition;
};
/**
* Alias a module definition.
*
* @param {String} from
* @param {String} to
* @api private
*/
require.alias = function(from, to) {
if (!require.modules.hasOwnProperty(from)) {
throw new Error('Failed to alias "' + from + '", it does not exist');
}
require.aliases[to] = from;
};
/**
* Return a require function relative to the `parent` path.
*
* @param {String} parent
* @return {Function}
* @api private
*/
require.relative = function(parent) {
var p = require.normalize(parent, '..');
/**
* lastIndexOf helper.
*/
function lastIndexOf(arr, obj) {
var i = arr.length;
while (i--) {
if (arr[i] === obj) return i;
}
return -1;
}
/**
* The relative require() itself.
*/
function localRequire(path) {
var resolved = localRequire.resolve(path);
return require(resolved, parent, path);
}
/**
* Resolve relative to the parent.
*/
localRequire.resolve = function(path) {
var c = path.charAt(0);
if ('/' == c) return path.slice(1);
if ('.' == c) return require.normalize(p, path);
// resolve deps by returning
// the dep in the nearest "deps"
// directory
var segs = parent.split('/');
var i = lastIndexOf(segs, 'deps') + 1;
if (!i) i = 0;
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
return path;
};
/**
* Check if module is defined at `path`.
*/
localRequire.exists = function(path) {
return require.modules.hasOwnProperty(localRequire.resolve(path));
};
return localRequire;
};
require.register("immediate/lib/index.js", function(exports, require, module){
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.immediate=e():"undefined"!=typeof global?global.immediate=e():"undefined"!=typeof self&&(self.immediate=e())}(function(){var define,module,exports;
return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};module.exports = typeof global === "object" && global ? global : this;
},{}],2:[function(require,module,exports){
"use strict";

@@ -250,8 +55,47 @@ var types = [

});
require.register("immediate/lib/nextTick.js", function(exports, require, module){
},{"./messageChannel":3,"./mutation":4,"./nextTick":5,"./postMessage":6,"./realSetImmediate":7,"./stateChange":8,"./timeout":9}],3:[function(require,module,exports){
"use strict";
var globe = require("./global");
exports.test = function () {
return !!globe.MessageChannel;
};
exports.install = function (func) {
var channel = new globe.MessageChannel();
channel.port1.onmessage = func;
return function () {
channel.port2.postMessage(0);
};
};
},{"./global":1}],4:[function(require,module,exports){
"use strict";
//based off rsvp
//https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/async.js
var globe = require("./global");
var MutationObserver = globe.MutationObserver || globe.WebKitMutationObserver;
exports.test = function () {
return MutationObserver;
};
exports.install = function (handle) {
var observer = new MutationObserver(handle);
var element = globe.document.createElement("div");
observer.observe(element, { attributes: true });
// Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661
globe.addEventListener("unload", function () {
observer.disconnect();
observer = null;
}, false);
return function () {
element.setAttribute("drainQueue", "drainQueue");
};
};
},{"./global":1}],5:[function(require,module,exports){
"use strict";
exports.test = function () {
// Don't get fooled by e.g. browserify environments.
return typeof process === "object" && Object.prototype.toString.call(process) === "[object process]";
return typeof process === "object" && !process.browser && Object.prototype.toString.call(process) === "[object process]";
};

@@ -262,4 +106,3 @@

};
});
require.register("immediate/lib/postMessage.js", function(exports, require, module){
},{}],6:[function(require,module,exports){
"use strict";

@@ -302,19 +145,15 @@ var globe = require("./global");

};
});
require.register("immediate/lib/messageChannel.js", function(exports, require, module){
},{"./global":1}],7:[function(require,module,exports){
"use strict";
var globe = require("./global");
exports.test = function () {
return !!globe.MessageChannel;
return globe.setImmediate;
};
exports.install = function (func) {
var channel = new globe.MessageChannel();
channel.port1.onmessage = func;
return function () {
channel.port2.postMessage(0);
};
exports.install = function (handle) {
//return globe.setImmediate.bind(globe, handle);
return globe.setTimeout.bind(globe,handle,0);
};
});
require.register("immediate/lib/stateChange.js", function(exports, require, module){
},{"./global":1}],8:[function(require,module,exports){
"use strict";

@@ -344,4 +183,3 @@ var globe = require("./global");

};
});
require.register("immediate/lib/timeout.js", function(exports, require, module){
},{"./global":1}],9:[function(require,module,exports){
"use strict";

@@ -357,54 +195,5 @@ exports.test = function () {

};
},{}]},{},[2])
(2)
});
require.register("immediate/lib/global.js", function(exports, require, module){
module.exports = typeof global === "object" && global ? global : this;
});
require.register("immediate/lib/mutation.js", function(exports, require, module){
"use strict";
//based off rsvp
//https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/async.js
var globe = require("./global");
var MutationObserver = globe.MutationObserver || globe.WebKitMutationObserver;
exports.test = function () {
return MutationObserver;
};
exports.install = function (handle) {
var observer = new MutationObserver(handle);
var element = globe.document.createElement("div");
observer.observe(element, { attributes: true });
// Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661
globe.addEventListener("unload", function () {
observer.disconnect();
observer = null;
}, false);
return function () {
element.setAttribute("drainQueue", "drainQueue");
};
};
});
require.register("immediate/lib/realSetImmediate.js", function(exports, require, module){
"use strict";
var globe = require("./global");
exports.test = function () {
return globe.setImmediate;
};
exports.install = function (handle) {
//return globe.setImmediate.bind(globe, handle);
return globe.setTimeout.bind(globe,handle,0);
};
});
require.alias("immediate/lib/index.js", "immediate/index.js");
if (typeof exports == "object") {
module.exports = require("immediate");
} else if (typeof define == "function" && define.amd) {
define(function(){ return require("immediate"); });
} else {
this["immediate"] = require("immediate");
}})();
;

@@ -1,1 +0,1 @@

!function(){function a(b,c,d){var e=a.resolve(b);if(null==e){d=d||b,c=c||"root";var f=new Error('Failed to require "'+d+'" from "'+c+'"');throw f.path=d,f.parent=c,f.require=!0,f}var g=a.modules[e];return g.exports||(g.exports={},g.client=g.component=!0,g.call(this,g.exports,a.relative(e),g)),g.exports}a.modules={},a.aliases={},a.resolve=function(b){"/"===b.charAt(0)&&(b=b.slice(1));for(var c=[b,b+".js",b+".json",b+"/index.js",b+"/index.json"],d=0;d<c.length;d++){var b=c[d];if(a.modules.hasOwnProperty(b))return b;if(a.aliases.hasOwnProperty(b))return a.aliases[b]}},a.normalize=function(a,b){var c=[];if("."!=b.charAt(0))return b;a=a.split("/"),b=b.split("/");for(var d=0;d<b.length;++d)".."==b[d]?a.pop():"."!=b[d]&&""!=b[d]&&c.push(b[d]);return a.concat(c).join("/")},a.register=function(b,c){a.modules[b]=c},a.alias=function(b,c){if(!a.modules.hasOwnProperty(b))throw new Error('Failed to alias "'+b+'", it does not exist');a.aliases[c]=b},a.relative=function(b){function c(a,b){for(var c=a.length;c--;)if(a[c]===b)return c;return-1}function d(c){var e=d.resolve(c);return a(e,b,c)}var e=a.normalize(b,"..");return d.resolve=function(d){var f=d.charAt(0);if("/"==f)return d.slice(1);if("."==f)return a.normalize(e,d);var g=b.split("/"),h=c(g,"deps")+1;return h||(h=0),d=g.slice(0,h+1).join("/")+"/deps/"+d},d.exists=function(b){return a.modules.hasOwnProperty(d.resolve(b))},d},a.register("immediate/lib/index.js",function(a,b,c){"use strict";function d(){var a,b=0,c=g;for(g=[];a=c[b++];)a()}var e,f=[b("./nextTick"),b("./mutation"),b("./realSetImmediate"),b("./postMessage"),b("./messageChannel"),b("./stateChange"),b("./timeout")],g=[];f.some(function(a){var b=a.test();return b&&(e=a.install(d)),b});var h=function(a){var b,c;return arguments.length>1&&"function"==typeof a&&(c=Array.prototype.slice.call(arguments,1),c.unshift(void 0),a=a.bind.apply(a,c)),1===(b=g.push(a))&&e(d),b};h.clear=function(a){return a<=g.length&&(g[a-1]=function(){}),this},c.exports=h}),a.register("immediate/lib/nextTick.js",function(a){"use strict";a.test=function(){return"object"==typeof process&&"[object process]"===Object.prototype.toString.call(process)},a.install=function(){return process.nextTick}}),a.register("immediate/lib/postMessage.js",function(a,b){"use strict";var c=b("./global");a.test=function(){if(!c.postMessage||c.importScripts)return!1;var a=!0,b=c.onmessage;return c.onmessage=function(){a=!1},c.postMessage("","*"),c.onmessage=b,a},a.install=function(a){function b(b){b.source===c&&b.data===d&&a()}var d="com.calvinmetcalf.setImmediate"+Math.random();return c.addEventListener?c.addEventListener("message",b,!1):c.attachEvent("onmessage",b),function(){c.postMessage(d,"*")}}}),a.register("immediate/lib/messageChannel.js",function(a,b){"use strict";var c=b("./global");a.test=function(){return!!c.MessageChannel},a.install=function(a){var b=new c.MessageChannel;return b.port1.onmessage=a,function(){b.port2.postMessage(0)}}}),a.register("immediate/lib/stateChange.js",function(a,b){"use strict";var c=b("./global");a.test=function(){return"document"in c&&"onreadystatechange"in c.document.createElement("script")},a.install=function(a){return function(){var b=c.document.createElement("script");return b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},c.document.documentElement.appendChild(b),a}}}),a.register("immediate/lib/timeout.js",function(a){"use strict";a.test=function(){return!0},a.install=function(a){return function(){setTimeout(a,0)}}}),a.register("immediate/lib/global.js",function(a,b,c){c.exports="object"==typeof global&&global?global:this}),a.register("immediate/lib/mutation.js",function(a,b){"use strict";var c=b("./global"),d=c.MutationObserver||c.WebKitMutationObserver;a.test=function(){return d},a.install=function(a){var b=new d(a),e=c.document.createElement("div");return b.observe(e,{attributes:!0}),c.addEventListener("unload",function(){b.disconnect(),b=null},!1),function(){e.setAttribute("drainQueue","drainQueue")}}}),a.register("immediate/lib/realSetImmediate.js",function(a,b){"use strict";var c=b("./global");a.test=function(){return c.setImmediate},a.install=function(a){return c.setTimeout.bind(c,a,0)}}),a.alias("immediate/lib/index.js","immediate/index.js"),"object"==typeof exports?module.exports=a("immediate"):"function"==typeof define&&define.amd?define(function(){return a("immediate")}):this.immediate=a("immediate")}();
!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.immediate=a():"undefined"!=typeof global?global.immediate=a():"undefined"!=typeof self&&(self.immediate=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};b.exports="object"==typeof c&&c?c:this},{}],2:[function(a,b){"use strict";function c(){var a,b=0,c=f;for(f=[];a=c[b++];)a()}var d,e=[a("./nextTick"),a("./mutation"),a("./realSetImmediate"),a("./postMessage"),a("./messageChannel"),a("./stateChange"),a("./timeout")],f=[];e.some(function(a){var b=a.test();return b&&(d=a.install(c)),b});var g=function(a){var b,e;return arguments.length>1&&"function"==typeof a&&(e=Array.prototype.slice.call(arguments,1),e.unshift(void 0),a=a.bind.apply(a,e)),1===(b=f.push(a))&&d(c),b};g.clear=function(a){return a<=f.length&&(f[a-1]=function(){}),this},b.exports=g},{"./messageChannel":3,"./mutation":4,"./nextTick":5,"./postMessage":6,"./realSetImmediate":7,"./stateChange":8,"./timeout":9}],3:[function(a,b,c){"use strict";var d=a("./global");c.test=function(){return!!d.MessageChannel},c.install=function(a){var b=new d.MessageChannel;return b.port1.onmessage=a,function(){b.port2.postMessage(0)}}},{"./global":1}],4:[function(a,b,c){"use strict";var d=a("./global"),e=d.MutationObserver||d.WebKitMutationObserver;c.test=function(){return e},c.install=function(a){var b=new e(a),c=d.document.createElement("div");return b.observe(c,{attributes:!0}),d.addEventListener("unload",function(){b.disconnect(),b=null},!1),function(){c.setAttribute("drainQueue","drainQueue")}}},{"./global":1}],5:[function(a,b,c){"use strict";c.test=function(){return"object"==typeof process&&!process.browser&&"[object process]"===Object.prototype.toString.call(process)},c.install=function(){return process.nextTick}},{}],6:[function(a,b,c){"use strict";var d=a("./global");c.test=function(){if(!d.postMessage||d.importScripts)return!1;var a=!0,b=d.onmessage;return d.onmessage=function(){a=!1},d.postMessage("","*"),d.onmessage=b,a},c.install=function(a){function b(b){b.source===d&&b.data===c&&a()}var c="com.calvinmetcalf.setImmediate"+Math.random();return d.addEventListener?d.addEventListener("message",b,!1):d.attachEvent("onmessage",b),function(){d.postMessage(c,"*")}}},{"./global":1}],7:[function(a,b,c){"use strict";var d=a("./global");c.test=function(){return d.setImmediate},c.install=function(a){return d.setTimeout.bind(d,a,0)}},{"./global":1}],8:[function(a,b,c){"use strict";var d=a("./global");c.test=function(){return"document"in d&&"onreadystatechange"in d.document.createElement("script")},c.install=function(a){return function(){var b=d.document.createElement("script");return b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},d.document.documentElement.appendChild(b),a}}},{"./global":1}],9:[function(a,b,c){"use strict";c.test=function(){return!0},c.install=function(a){return function(){setTimeout(a,0)}}},{}]},{},[2])(2)});
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
component: {
build: {
browserify: {
dist: {
files: {
'dist/<%= pkg.name %>.js': ["lib/index.js"],
},
options: {
args: {
out: 'dist',
name: '<%= pkg.name %>',
standalone: '<%= pkg.name %>'
}
standalone: '<%= pkg.name %>',
noParse:['lib/nextTick.js']
}

@@ -26,5 +26,5 @@ }

});
grunt.loadNpmTasks('grunt-component');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['component', 'uglify']);
grunt.registerTask('default', ['browserify', 'uglify']);
}
{
"name": "immediate",
"description": "A shim for the setImmediate efficient script yielding API",
"version": "2.4.3",
"description": "A polyfill for the setImmediate efficient script yielding API",
"version": "2.5.0",
"contributors": [

@@ -14,5 +14,5 @@ "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",

"type": "git",
"url": "git://github.com/calvinmetcalf/setImmediate.git"
"url": "git://github.com/calvinmetcalf/immediate.git"
},
"bugs": "https://github.com/calvinmetcalf/setImmediate/issues",
"bugs": "https://github.com/calvinmetcalf/immediate/issues",
"main": "lib/index.js",

@@ -28,8 +28,8 @@ "scripts": {

"opener": "~1.3",
"component": "~0.17.6",
"grunt-component": "~0.1.7",
"grunt-contrib-uglify": "~0.2.4",
"grunt": "~0.4.1"
"grunt": "~0.4.1",
"browserify": "~2.35.0",
"grunt-browserify": "~1.2.9"
},
"jam":{
"jam": {
"main": "dist/immediate.js"

@@ -36,0 +36,0 @@ },

@@ -7,3 +7,3 @@

immediate takes the tricks from setImmedate and combines them with the schedualer from when to make a
immediate takes the tricks from setImmedate and RSVP and combines them with the schedualer from when to make a low latency polyfill.

@@ -66,5 +66,2 @@ ## The Tricks

## Demo
* [Quick sort demo][cross-browser-demo]

@@ -77,2 +74,3 @@ ## Reference and Reading

* [Introductory blog post by Nicholas C. Zakas][ncz]
* I wrote a couple blog pots on this, [part 1][my-blog-1] and [part 2][my-blog-2]

@@ -88,1 +86,3 @@ [RSVP]: https://github.com/tildeio/rsvp.js

[cross-browser-demo]: http://calvinmetcalf.github.io/setImmediate-shim-demo
[my-blog-1]:http://calvinmetcalf.com/post/61672207151/setimmediate-etc
[my-blog-2]:http://calvinmetcalf.com/post/61761231881/javascript-schedulers
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc