aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tapable
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/tapable
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/tapable')
-rw-r--r--node_modules/tapable/README.md26
-rw-r--r--node_modules/tapable/lib/Tapable.js75
-rw-r--r--node_modules/tapable/package.json2
3 files changed, 91 insertions, 12 deletions
diff --git a/node_modules/tapable/README.md b/node_modules/tapable/README.md
index 7a7d175ac..820cd2432 100644
--- a/node_modules/tapable/README.md
+++ b/node_modules/tapable/README.md
@@ -60,7 +60,7 @@ void plugin(names: string|string[], handler: Function)
void applyPlugins(name: string, args: any...)
```
-Synchronous applies all registered handers for `name`. The handler functions are called with all args.
+Synchronously applies all registered handlers for `name`. The handler functions are called with all args.
### applyPluginsWaterfall
@@ -68,7 +68,7 @@ Synchronous applies all registered handers for `name`. The handler functions are
any applyPluginsWaterfall(name: string, init: any, args: any...)
```
-Synchronous applies all registered handers for `name`. The handler functions are called with the return value of the previous handler and all args. For the first handler `init` is used and the return value of the last handler is return by `applyPluginsWaterfall`
+Synchronously applies all registered handlers for `name`. The handler functions are called with the return value of the previous handler and all args. For the first handler `init` is used and the return value of the last handler is return by `applyPluginsWaterfall`
### applyPluginsAsync
@@ -80,7 +80,7 @@ void applyPluginsAsync(
)
```
-Asynchronously applies all registered handers for `name`. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The hander functions are called in order of registration.
+Asynchronously applies all registered handlers for `name`. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The handler functions are called in order of registration.
`callback` is called after all handlers are called.
@@ -90,7 +90,7 @@ Asynchronously applies all registered handers for `name`. The handler functions
any applyPluginsBailResult(name: string, args: any...)
```
-Synchronous applies all registered handers for `name`. The handler function are called with all args. If a handler function returns something `!== undefined`, the value is returned and no more handers are applied.
+Synchronously applies all registered handlers for `name`. The handler function are called with all args. If a handler function returns something `!== undefined`, the value is returned and no more handlers are applied.
### applyPluginsAsyncWaterfall
@@ -102,7 +102,7 @@ applyPluginsAsyncWaterfall(
)
```
-Asynchronously applies all registered handers for `name`. The hander functions are called with the current value and a callback function with the signature `(err: Error, nextValue: any) -> void`. When called `nextValue` is the current value for the next handler. The current value for the first handler is `init`. After all handlers are applied, `callback` is called with the last value. If any handler passes a value for `err`, the `callback` is called with this error and no more handlers are called.
+Asynchronously applies all registered handlers for `name`. The handler functions are called with the current value and a callback function with the signature `(err: Error, nextValue: any) -> void`. When called, `nextValue` is the current value for the next handler. The current value for the first handler is `init`. After all handlers are applied, `callback` is called with the last value. If any handler passes a value for `err`, the `callback` is called with this error and no more handlers are called.
### applyPluginsAsyncSeries
@@ -114,7 +114,7 @@ applyPluginsAsyncSeries(
)
```
-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.
+Asynchronously applies all registered handlers for `name`. The handler functions are called with all `args` and a callback function with the signature `(err: Error) -> void`. The handlers 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.
### applyPluginsParallel
@@ -126,7 +126,7 @@ applyPluginsParallel(
)
```
-Applies all registered handlers for `name` parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The `callback` function is called when all handlers called the callback without `err`. If any handler calls the callback with `err`, `callback` is invoked with this error and the other handlers are ignored.
+Applies all registered handlers for `name` in parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. The `callback` function is called when all handlers have called the callback without `err`. If any handler calls the callback with `err`, `callback` is invoked with this error and the other handlers are ignored.
### applyPluginsParallelBailResult
@@ -138,4 +138,14 @@ applyPluginsParallelBailResult(
)
```
-Applies all registered handlers for `name` parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. Handler functions must call the callback. They can either pass an error, or pass undefined, or pass an value. The first result (either error or value) with is not undefined is passed to the `callback`. The order is defined by registeration not by speed of the handler function. This function compentate this.
+Applies all registered handlers for `name` in parallel. The handler functions are called with all args and a callback function with the signature `(err?: Error) -> void`. Handler functions must call the callback. They can either pass an error, pass undefined, or pass a value. The first result (either error or value) which is not undefined is passed to the `callback`. The order is defined by registration, not by the speed of the handler function.
+
+### hasPlugins
+
+``` js
+hasPlugins(
+ name: string
+)
+```
+
+Returns true, if plugins are registered for this name.
diff --git a/node_modules/tapable/lib/Tapable.js b/node_modules/tapable/lib/Tapable.js
index c7521baf7..a8514c416 100644
--- a/node_modules/tapable/lib/Tapable.js
+++ b/node_modules/tapable/lib/Tapable.js
@@ -84,11 +84,13 @@ Tapable.prototype.applyPlugins2 = function applyPlugins2(name, param1, param2) {
Tapable.prototype.applyPluginsWaterfall = function applyPluginsWaterfall(name, init) {
if(!this._plugins[name]) return init;
- var args = Array.prototype.slice.call(arguments, 2);
+ var args = Array.prototype.slice.call(arguments, 1);
var plugins = this._plugins[name];
var current = init;
- for(var i = 0; i < plugins.length; i++)
- current = plugins[i].apply(this, [current].concat(args));
+ for(var i = 0; i < plugins.length; i++) {
+ args[0] = current;
+ current = plugins[i].apply(this, args);
+ }
return current;
};
@@ -101,6 +103,24 @@ Tapable.prototype.applyPluginsWaterfall0 = function applyPluginsWaterfall0(name,
return current;
};
+Tapable.prototype.applyPluginsWaterfall1 = function applyPluginsWaterfall1(name, init, param) {
+ var plugins = this._plugins[name];
+ if(!plugins) return init;
+ var current = init;
+ for(var i = 0; i < plugins.length; i++)
+ current = plugins[i].call(this, current, param);
+ return current;
+};
+
+Tapable.prototype.applyPluginsWaterfall2 = function applyPluginsWaterfall2(name, init, param1, param2) {
+ var plugins = this._plugins[name];
+ if(!plugins) return init;
+ var current = init;
+ for(var i = 0; i < plugins.length; i++)
+ current = plugins[i].call(this, current, param1, param2);
+ return current;
+};
+
Tapable.prototype.applyPluginsBailResult = function applyPluginsBailResult(name) {
if(!this._plugins[name]) return;
var args = Array.prototype.slice.call(arguments, 1);
@@ -124,6 +144,50 @@ Tapable.prototype.applyPluginsBailResult1 = function applyPluginsBailResult1(nam
}
};
+Tapable.prototype.applyPluginsBailResult2 = function applyPluginsBailResult2(name, param1, param2) {
+ if(!this._plugins[name]) return;
+ var plugins = this._plugins[name];
+ for(var i = 0; i < plugins.length; i++) {
+ var result = plugins[i].call(this, param1, param2);
+ if(typeof result !== "undefined") {
+ return result;
+ }
+ }
+};
+
+Tapable.prototype.applyPluginsBailResult3 = function applyPluginsBailResult3(name, param1, param2, param3) {
+ if(!this._plugins[name]) return;
+ var plugins = this._plugins[name];
+ for(var i = 0; i < plugins.length; i++) {
+ var result = plugins[i].call(this, param1, param2, param3);
+ if(typeof result !== "undefined") {
+ return result;
+ }
+ }
+};
+
+Tapable.prototype.applyPluginsBailResult4 = function applyPluginsBailResult4(name, param1, param2, param3, param4) {
+ if(!this._plugins[name]) return;
+ var plugins = this._plugins[name];
+ for(var i = 0; i < plugins.length; i++) {
+ var result = plugins[i].call(this, param1, param2, param3, param4);
+ if(typeof result !== "undefined") {
+ return result;
+ }
+ }
+};
+
+Tapable.prototype.applyPluginsBailResult5 = function applyPluginsBailResult5(name, param1, param2, param3, param4, param5) {
+ if(!this._plugins[name]) return;
+ var plugins = this._plugins[name];
+ for(var i = 0; i < plugins.length; i++) {
+ var result = plugins[i].call(this, param1, param2, param3, param4, param5);
+ if(typeof result !== "undefined") {
+ return result;
+ }
+ }
+};
+
Tapable.prototype.applyPluginsAsyncSeries = Tapable.prototype.applyPluginsAsync = function applyPluginsAsyncSeries(name) {
var args = Array.prototype.slice.call(arguments, 1);
var callback = args.pop();
@@ -289,6 +353,11 @@ Tapable.prototype.applyPluginsParallelBailResult1 = function applyPluginsParalle
}
};
+Tapable.prototype.hasPlugins = function hasPlugins(name) {
+ var plugins = this._plugins[name];
+ return plugins && plugins.length > 0;
+};
+
Tapable.prototype.plugin = function plugin(name, fn) {
if(Array.isArray(name)) {
diff --git a/node_modules/tapable/package.json b/node_modules/tapable/package.json
index 1d4941fd8..fe0710a89 100644
--- a/node_modules/tapable/package.json
+++ b/node_modules/tapable/package.json
@@ -1,6 +1,6 @@
{
"name": "tapable",
- "version": "0.2.6",
+ "version": "0.2.8",
"author": "Tobias Koppers @sokra",
"description": "Just a little module for plugins.",
"license": "MIT",