new Manager(app)
This object controls the Waiters responsible for handling events from all areas of the app.
Parameters:
Name | Type | Description |
---|---|---|
app |
HTMLApp | The main view object for CyberChef. |
- Copyright:
-
- Crown Copyright 2016
- License:
-
- Apache-2.0
- Source:
Methods
-
setup()
-
Sets up the various components and listeners.
- Source:
-
initialise_event_listeners()
-
Main function to handle the creation of the event listeners.
- Source:
-
add_listeners(selector, event_type, callback [, scope])
-
Adds an event listener to each element in the specified group.
Parameters:
Name Type Argument Default Description selector
string A selector string for the element group to add the event to, see
this.get_all()event_type
string The event to listen for
callback
function The function to execute when the event is triggered
scope
Object <optional>
this The object to bind to the callback function
- Source:
Example
// Calls the clickable function whenever any element with the .clickable class is clicked this.add_listeners(".clickable", "click", this.clickable, this);
-
add_multi_event_listener(selector, event_types, callback [, scope])
-
Adds multiple event listeners to the specified element.
Parameters:
Name Type Argument Default Description selector
string A selector string for the element to add the events to
event_types
string A space-separated string of all the event types to listen for
callback
function The function to execute when the events are triggered
scope
Object <optional>
this The object to bind to the callback function
- Source:
Example
// Calls the search function whenever the the keyup, paste or search events are triggered on the // search element this.add_multi_event_listener("search", "keyup paste search", this.search, this);
-
add_multi_event_listeners(selector, event_types, callback [, scope])
-
Adds multiple event listeners to each element in the specified group.
Parameters:
Name Type Argument Default Description selector
string A selector string for the element group to add the events to
event_types
string A space-separated string of all the event types to listen for
callback
function The function to execute when the events are triggered
scope
Object <optional>
this The object to bind to the callback function
- Source:
Example
// Calls the save function whenever the the keyup or paste events are triggered on any element // with the .saveable class this.add_multi_event_listener(".saveable", "keyup paste", this.save, this);
-
add_dynamic_listener(selector, event_type, callback [, scope])
-
Adds an event listener to the global document object which will listen on dynamic elements which
may not exist in the DOM yet.Parameters:
Name Type Argument Default Description selector
string A selector string for the element(s) to add the event to
event_type
string The event(s) to listen for
callback
function The function to execute when the event(s) is/are triggered
scope
Object <optional>
this The object to bind to the callback function
- Source:
Example
// Pops up an alert whenever any button is clicked, even if it is added to the DOM after this // listener is created this.add_dynamic_listener("button", "click", alert, this);
-
dynamic_listener_handler(e)
-
Handler for dynamic events. This function is called for any dynamic event and decides which
callback(s) to execute based on the type and selector.Parameters:
Name Type Description e
Event The event to be handled
- Source:
Events
-
appstart
-
- Source:
-
operationadd
-
- Source:
Listeners of This Event:
-
operationremove
-
- Source:
Listeners of This Event:
-
oplistcreate
-
- Source:
Listeners of This Event:
-
statechange
-
- Source:
Listeners of This Event: