EventHandle
afterHostEvent
(
type
,
fn
,
context
)
Listens for the "after" moment of events fired by the host object.
Listeners attached through this method will be detached when the plugin is unplugged.
- Parameters:
-
type
<String | Object>
The event type.
-
fn
<Function>
The listener.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the listener.
EventHandle
afterHostMethod
(
The
,
fn
,
context
)
Injects a function to be executed after a given method on host object.
The function will be detached when the plugin is unplugged.
- Parameters:
-
The
<String>
name of the method to inject the function after.
-
fn
<Function>
The function to inject.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the injected function.
EventHandle
beforeHostMethod
(
The
,
fn
,
context
)
Injects a function to be executed before a given method on host object.
The function will be detached when the plugin is unplugged.
- Parameters:
-
The
<String>
name of the method to inject the function before.
-
fn
<Function>
The function to inject.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the injected function.
void
destructor
(
)
Destructor lifecycle implementation.
Removes any event listeners or injected methods applied by the Plugin
EventHandle
doAfter
(
strMethod
,
fn
,
context
)
Listens for the "after" moment of events fired by the host,
or injects code "after" a given method on the host.
- Parameters:
-
strMethod
<String>
The event to listen for, or method to inject logic after.
-
fn
<Function>
The handler function. For events, the "after" moment listener. For methods, the function to execute after the given method is executed.
-
context
<Object>
An optional context to call the handler with. The default context is the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the listener.
EventHandle
doBefore
(
strMethod
,
fn
,
context
)
Listens for the "on" moment of events fired by the host,
or injects code "before" a given method on the host.
- Parameters:
-
strMethod
<String>
The event to listen for, or method to inject logic before.
-
fn
<Function>
The handler function. For events, the "on" moment listener. For methods, the function to execute before the given method is executed.
-
context
<Object>
An optional context to call the handler with. The default context is the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the handler.
void
initializer
(
config
)
Initializer lifecycle implementation.
- Parameters:
-
config
<Object>
Configuration object with property name/value pairs.
EventHandle
onHostEvent
(
type
,
fn
,
context
)
Listens for the "on" moment of events fired by the host object.
Listeners attached through this method will be detached when the plugin is unplugged.
- Parameters:
-
type
<String | Object>
The event type.
-
fn
<Function>
The listener.
-
context
<Object>
The execution context. Defaults to the plugin instance.
- Returns:
EventHandle
- handle The detach handle for the listener.