Comparing version 0.1.3 to 0.1.4
@@ -59,2 +59,21 @@ /* | ||
Tapable.prototype.applyPluginsAsyncSeries = function applyPluginsAsyncSeries(name) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
var callback = args.pop(); | ||
if(!this._plugins[name] || this._plugins[name].length == 0) return callback(); | ||
var plugins = this._plugins[name]; | ||
var old = this._currentPluginApply; | ||
this._currentPluginApply = 0; | ||
args.push(function next(err) { | ||
if(err) return callback(err); | ||
this._currentPluginApply++; | ||
if(this._currentPluginApply >= plugins.length) { | ||
this._currentPluginApply = old; | ||
return callback(); | ||
} | ||
plugins[this._currentPluginApply].apply(this, args); | ||
}.bind(this)); | ||
plugins[0].apply(this, args); | ||
}; | ||
Tapable.prototype.applyPluginsAsyncWaterfall = function applyPluginsAsyncWaterfall(name, init, callback) { | ||
@@ -61,0 +80,0 @@ if(!this._plugins[name] || this._plugins[name].length == 0) return callback(null, init); |
{ | ||
"name": "tapable", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Just a little module for plugins.", |
@@ -96,2 +96,12 @@ # Tapable | ||
``` javascript | ||
applyPluginsAsyncSeries( | ||
name: string, | ||
args: any..., | ||
callback: (err: Error, result: any) -> void | ||
) | ||
``` | ||
Asynchronously applies all registered handers for `name`. The hander functions are called with all `args` and a callback function with the signature `(err: Error) -> void`. The handers are called in series, one at a time. After all handlers are applied, `callback` is called. If any handler passes a value for `err`, the `callback` is called with this error and no more handlers are called. | ||
``` javascript | ||
applyPluginsParallel( | ||
@@ -98,0 +108,0 @@ name: string, |
@@ -0,0 +0,0 @@ /* |
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
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
14186
286
128