Comparing version 0.1.6 to 0.2.0
@@ -1,109 +0,105 @@ | ||
/*! async_fn (v0.1.6), | ||
One-method library for calling asynchronous functions one by one in a queue, | ||
by Sergey Shishkalov <sergeyshishkalov@gmail.com> | ||
Thu Nov 20 2014 */ | ||
(function() { | ||
var modules; | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["AsyncFn"] = factory(); | ||
else | ||
root["AsyncFn"] = factory(); | ||
})(this, function() { | ||
return webpackJsonpAsyncFn([0],[ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
modules = {}; | ||
module.exports = __webpack_require__(1); | ||
if (window.modula == null) { | ||
window.modula = { | ||
"export": function(name, exports) { | ||
return modules[name] = exports; | ||
}, | ||
require: function(name) { | ||
var Module; | ||
Module = modules[name]; | ||
if (Module) { | ||
return Module; | ||
} else { | ||
throw "Module '" + name + "' not found."; | ||
} | ||
} | ||
}; | ||
} | ||
}).call(this); | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
(function() { | ||
window.AsyncFn = (function() { | ||
function AsyncFn(asyncFn) { | ||
this.dfd = new $.Deferred(); | ||
this.fn = asyncFn; | ||
} | ||
var $; | ||
$ = __webpack_require__(2); | ||
module.exports = window.AsyncFn = (function() { | ||
function AsyncFn(asyncFn) { | ||
this.dfd = new $.Deferred(); | ||
this.fn = asyncFn; | ||
} | ||
AsyncFn.prototype.done = function(callback) { | ||
this.callback = callback; | ||
if (this.isCalled) { | ||
return this.callback(); | ||
} | ||
}; | ||
AsyncFn.prototype.call = function() { | ||
if (this.isCalled) { | ||
return; | ||
} | ||
return this.fn().always((function(_this) { | ||
return function() { | ||
_this.isCalled = true; | ||
_this.dfd.resolve(); | ||
if (_this.callback) { | ||
return _this.callback(); | ||
} | ||
}; | ||
})(this)); | ||
}; | ||
AsyncFn.addToCallQueue = function(fn) { | ||
var asyncFn; | ||
asyncFn = new AsyncFn(fn); | ||
if (this.currentFn != null) { | ||
this.currentFn.done(function() { | ||
return asyncFn.call(); | ||
}); | ||
} else { | ||
asyncFn.call(); | ||
} | ||
return this.currentFn = asyncFn; | ||
}; | ||
AsyncFn.setImmediate = (function() { | ||
var ID, head, onmessage, tail; | ||
head = {}; | ||
tail = head; | ||
ID = Math.random(); | ||
onmessage = function(e) { | ||
var func; | ||
if (e.data.toString() !== ID.toString()) { | ||
return; | ||
} | ||
head = head.next; | ||
func = head.func; | ||
delete head.func; | ||
return func(); | ||
}; | ||
if (window.addEventListener && window.postMessage) { | ||
window.addEventListener('message', onmessage, false); | ||
return function(func) { | ||
tail = tail.next = { | ||
func: func | ||
}; | ||
return window.postMessage(ID, '*'); | ||
}; | ||
} else { | ||
return function(func) { | ||
return setTimeout(func, 0); | ||
}; | ||
} | ||
})(); | ||
return AsyncFn; | ||
AsyncFn.prototype.done = function(callback) { | ||
this.callback = callback; | ||
if (this.isCalled) { | ||
return this.callback(); | ||
} | ||
}; | ||
})(); | ||
AsyncFn.prototype.call = function() { | ||
if (this.isCalled) { | ||
return; | ||
} | ||
return this.fn().always((function(_this) { | ||
return function() { | ||
_this.isCalled = true; | ||
_this.dfd.resolve(); | ||
if (_this.callback) { | ||
return _this.callback(); | ||
} | ||
}; | ||
})(this)); | ||
}; | ||
AsyncFn.addToCallQueue = function(fn) { | ||
var asyncFn; | ||
asyncFn = new AsyncFn(fn); | ||
if (this.currentFn != null) { | ||
this.currentFn.done((function(_this) { | ||
return function() { | ||
return asyncFn.call(); | ||
}; | ||
})(this)); | ||
} else { | ||
asyncFn.call(); | ||
} | ||
return this.currentFn = asyncFn; | ||
}; | ||
AsyncFn.setImmediate = (function() { | ||
var ID, head, onmessage, tail; | ||
head = {}; | ||
tail = head; | ||
ID = Math.random(); | ||
onmessage = function(e) { | ||
var func; | ||
if (e.data.toString() !== ID.toString()) { | ||
return; | ||
} | ||
head = head.next; | ||
func = head.func; | ||
delete head.func; | ||
return func(); | ||
}; | ||
if (window.addEventListener && window.postMessage) { | ||
window.addEventListener('message', onmessage, false); | ||
return function(func) { | ||
tail = tail.next = { | ||
func: func | ||
}; | ||
return window.postMessage(ID, '*'); | ||
}; | ||
} else { | ||
return function(func) { | ||
return setTimeout(func, 0); | ||
}; | ||
} | ||
})(); | ||
return AsyncFn; | ||
})(); | ||
modula["export"]('async_fn', AsyncFn); | ||
}).call(this); | ||
/***/ } | ||
]) | ||
}); | ||
; |
@@ -1,5 +0,2 @@ | ||
/*! async_fn (v0.1.6), | ||
One-method library for calling asynchronous functions one by one in a queue, | ||
by Sergey Shishkalov <sergeyshishkalov@gmail.com> | ||
Thu Nov 20 2014 */ | ||
(function(){var n;n={},null==window.modula&&(window.modula={"export":function(t,e){return n[t]=e},require:function(t){var e;if(e=n[t])return e;throw"Module '"+t+"' not found."}})}).call(this),function(){window.AsyncFn=function(){function n(n){this.dfd=new $.Deferred,this.fn=n}return n.prototype.done=function(n){return this.callback=n,this.isCalled?this.callback():void 0},n.prototype.call=function(){return this.isCalled?void 0:this.fn().always(function(n){return function(){return n.isCalled=!0,n.dfd.resolve(),n.callback?n.callback():void 0}}(this))},n.addToCallQueue=function(t){var e;return e=new n(t),null!=this.currentFn?this.currentFn.done(function(){return function(){return e.call()}}(this)):e.call(),this.currentFn=e},n.setImmediate=function(){var n,t,e,r;return t={},r=t,n=Math.random(),e=function(e){var r;if(e.data.toString()===n.toString())return t=t.next,r=t.func,delete t.func,r()},window.addEventListener&&window.postMessage?(window.addEventListener("message",e,!1),function(t){return r=r.next={func:t},window.postMessage(n,"*")}):function(n){return setTimeout(n,0)}}(),n}(),modula["export"]("async_fn",AsyncFn)}.call(this); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AsyncFn=t():n.AsyncFn=t()}(this,function(){return webpackJsonpAsyncFn([0],[function(n,t,e){n.exports=e(1)},function(n,t,e){var o;o=e(2),n.exports=window.AsyncFn=function(){function n(n){this.dfd=new o.Deferred,this.fn=n}return n.prototype.done=function(n){if(this.callback=n,this.isCalled)return this.callback()},n.prototype.call=function(){if(!this.isCalled)return this.fn().always(function(n){return function(){if(n.isCalled=!0,n.dfd.resolve(),n.callback)return n.callback()}}(this))},n.addToCallQueue=function(t){var e;return e=new n(t),null!=this.currentFn?this.currentFn.done(function(){return e.call()}):e.call(),this.currentFn=e},n.setImmediate=function(){var n,t,e,o;return t={},o=t,n=Math.random(),e=function(e){var o;if(e.data.toString()===n.toString())return t=t.next,o=t.func,delete t.func,o()},window.addEventListener&&window.postMessage?(window.addEventListener("message",e,!1),function(t){return o=o.next={func:t},window.postMessage(n,"*")}):function(n){return setTimeout(n,0)}}(),n}()}])}); | ||
//# sourceMappingURL=async_fn.min.js.map |
{ | ||
"name": "async_fn", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"author": "Sergey Shishkalov <sergeyshishkalov@gmail.com>", | ||
"description": "One-method library for calling asynchronous functions one by one in a queue", | ||
"devDependencies": { | ||
"coffee-script": "~1.7.1", | ||
"mocha": "~1.18.2", | ||
"chai": "~1.9.1", | ||
"sinon": "~1.9.1", | ||
"sinon-chai": "~2.5.0", | ||
"karma": "~0.12.16", | ||
"karma-cli": "~0.0.4", | ||
"karma-html2js-preprocessor": "~0.1.0", | ||
"karma-coffee-preprocessor": "~0.2.1", | ||
"karma-phantomjs-launcher": "~0.1.4", | ||
"karma-mocha": "~0.1.3", | ||
"karma-chai": "~0.1.0", | ||
"karma-sinon-chai": "~0.1.5", | ||
"gulp": "~3.6.2", | ||
"gulp-util": "~2.2.14", | ||
"gulp-coffee": "~1.4.3", | ||
"gulp-concat": "~2.2.0", | ||
"gulp-uglify": "~0.3.0", | ||
"gulp-header": "~1.0.2", | ||
"gulp-rename": "~1.2.0", | ||
"gulp-karma": "git://github.com/s0ber/gulp-karma.git#ignore_gulp_src_files", | ||
"coffeegulp": "~0.0.4" | ||
"chai": "^3.5.0", | ||
"coffee-loader": "^0.7.2", | ||
"coffee-script": "^1.10.0", | ||
"coffeelint": "^1.9.7", | ||
"coffeelint-mocha": "0.1.0", | ||
"ejs-loader": "^0.3.0", | ||
"es6-collections": "^0.5.6", | ||
"jquery": "^3.1.1", | ||
"karma": "^0.13.22", | ||
"karma-chai": "^0.1.0", | ||
"karma-cli": "^0.1.2", | ||
"karma-mocha": "^0.2.2", | ||
"karma-mocha-reporter": "^2.2.1", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"karma-sinon-chai": "^1.2.0", | ||
"karma-webpack": "^1.7.0", | ||
"lolex": "^1.4.0", | ||
"mocha": "^2.4.5", | ||
"phantomjs-prebuilt": "^2.1.5", | ||
"pre-commit": "^1.1.3", | ||
"raw-loader": "^0.5.1", | ||
"sinon": "^1.17.3", | ||
"sinon-chai": "^2.8.0", | ||
"underscore": "^1.8.3", | ||
"unminified-webpack-plugin": "^1.1.1", | ||
"webpack": "^1.12.14", | ||
"webpack-dev-middleware": "^1.5.1", | ||
"webpack-hot-middleware": "^2.10.0" | ||
}, | ||
"peerDependencies": { | ||
"jquery": "^3.1.1" | ||
}, | ||
"engine": { | ||
@@ -35,3 +43,4 @@ "node": ">= 0.10" | ||
"scripts": { | ||
"test": "gulp --require coffee-script/register karma:ci" | ||
"build": "env NODE_ENV=production webpack", | ||
"test": "karma start" | ||
}, | ||
@@ -38,0 +47,0 @@ "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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19444
168
1
28
12
1
1