jsPlumbUtil.EventGenerator Class
Provides event bind/fire functionality.
Item Index
Methods
bind
-
event
-
listener
-
[insertAtStart=false]
Binds a listener to one or more events.
Parameters:
-
event
String | StringName(s) of the event(s) to bind to. Note that if you provide multiple event names they all are bound with the same function.
-
listener
FunctionFunction to execute.
-
[insertAtStart=false]
Boolean optionalWhether or not to insert this listener at the start of the listener list, so it is fired before the other currently registered listeners.
cleanupListeners
()
Removes all listeners.
fire
-
event
-
value
-
originalEvent
Fires an update for the given event.
Parameters:
-
event
StringEvent to fire
-
value
ObjectValue to pass to the event listener(s).
-
originalEvent
EventThe original event from the browser
isSuspendEvents
()
Boolean
Checks whether or not events are currently suspended.
Returns:
True if events are suspended, false otherwise.
jsPlumbUtil.replace
-
inObj
-
path
-
value
Replaces values inside some JS object according to a given path spec. A path spec is a string in dotted notation, with each component optionally declaring an array index. Some examples are:
foo.bar foo.baz[2] foo.qux[3].baz[3].shwee
The function fails gracefully if the path identifies a non-existent object.
Parameters:
-
inObj
ObjectObject to perform replacements inside.
-
path
StringPath to use for replacements
-
value
ObjectValue to set.
setSuspendEvents
-
val
Sets whether or not events are suspended.
Parameters:
-
val
BooleanWhether or not to suspend events.
unbind
-
[eventOrListener]
-
[listener]
Clears either all listeners, or listeners for some specific event, or just some listener. You can call this method with zero, one or two arguments: with zero arguments, all listeners are cleared. With one argument that is a string, all listeners for the specified event type are cleared. With one argument that is a function, it is removed from the appropriate event list. With two arguments, the first is an event type, and the second is a function to be unbound. In fact this is perhaps unnecessary given that you can unbind a function just by passing it.
Parameters:
-
[eventOrListener]
String | Function optionalIf a string, constrains the clear to just listeners for the event identified by the string. If a Function, unbinds this function wherever it may have been bound.
-
[listener]
Function optionalIf provided, removes just this listener for the given event.