You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/api/tapable.md
+8-10Lines changed: 8 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -12,19 +12,17 @@ contributors:
12
12
13
13
`Tapable` has four groups of member functions:
14
14
15
-
-`plugin(name:string, handler:function)` - This allows a custom plugin to register into a **Tapable instance**'s event.
16
-
This acts as the same as `on()` of `EventEmitter`, for registering a handler/listener to do something when the signal/event happens.
17
-
-`apply(…pluginInstances: (AnyPlugin|function)[])` - `AnyPlugin` should be a class (or, rarely, an object) that has an `apply` method, or just a function with some registration code inside. This method is just to **apply** plugins' definition, so that the real event listeners can be registered into the _Tapable_ instance's registry.
18
-
-`applyPlugins*(name:string, …)` - The _Tapable_ instance can apply all the plugins under a particular hash using these functions.
19
-
These group of method act like `emit()` of `EventEmitter`, to control the event emission meticulously with various strategy for various use cases.
20
-
-`mixin(pt: Object)` - a simple method to extend `Tapable`'s prototype as a mixin rather than inheritance.
15
+
-`plugin(name:string, handler:function)`: This allows a custom plugin to register into a **Tapable instance**'s event. This acts as the same as `on()` of `EventEmitter`, for registering a handler/listener to do something when the signal/event happens.
16
+
-`apply(…pluginInstances: (AnyPlugin|function)[])`: `AnyPlugin` should be a class (or, rarely, an object) that has an `apply` method, or just a function with some registration code inside. This method is just to **apply** plugins' definition, so that the real event listeners can be registered into the _Tapable_ instance's registry.
17
+
-`applyPlugins*(name:string, …)`: The _Tapable_ instance can apply all the plugins under a particular hash using these functions. These group of method act like `emit()` of `EventEmitter`, to control the event emission meticulously with various strategy for various use cases.
18
+
-`mixin(pt: Object)`: a simple method to extend `Tapable`'s prototype as a mixin rather than inheritance.
21
19
22
20
The different `applyPlugins*` methods cover the following use cases:
23
21
24
-
- Plugins can run serially
25
-
- Plugins can run in parallel
26
-
- Plugins can run one after the other but taking input from the previous plugin (waterfall)
27
-
- Plugins can run asynchronously
22
+
- Plugins can run serially.
23
+
- Plugins can run in parallel.
24
+
- Plugins can run one after the other but taking input from the previous plugin (waterfall).
25
+
- Plugins can run asynchronously.
28
26
- Quit running plugins on bail: that is, once one plugin returns non-`undefined`, jump out of the run flow and return _the return of that plugin_. This sounds like `once()` of `EventEmitter` but is totally different.
0 commit comments