Hooks(optsopt)
Provides hook mechanics.
Constructor
new Hooks(optsopt)
Parameters:
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
opts opt
|
object |
Properties
|
- License:
- Apache-2.0Copyright 2020 Satoshi Soma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. - Source:
- lib/Hooks.js, line 19
Methods
add(hooks)
Adds hook function(s).
Parameters:
Name | Type | Description |
---|---|---|
hooks
|
object | Key = hook name, Value = function |
- Source:
- lib/Hooks.js, line 35
apply(key, value, …argsoptrpt) → any
Modifies the given value with the hook functions associated with the given key.
Parameters:
Name | Type | Description |
---|---|---|
key
|
string | |
value
|
any | Value to pass to the functions |
args optrpt
|
any | Additional args to pass to the functions |
- Source:
- lib/Hooks.js, line 61
Returns:
Modified value
- Type:
- any
do(key, …argsoptrpt)
Invokes the hook functions associated with the given key.
Parameters:
Name | Type | Description |
---|---|---|
key
|
string | |
args optrpt
|
any | Args to pass to the functions |
- Source:
- lib/Hooks.js, line 46
has(key) → boolean
Returns whether any hook function associated with the given key exists.
Parameters:
Name | Type | Description |
---|---|---|
key
|
string |
- Source:
- lib/Hooks.js, line 75
Returns:
- Type:
- boolean