Show:

jsPlumbUtil.EventGenerator Class

Provides event bind/fire functionality.

Methods

bind

(
  • event
  • listener
  • [insertAtStart=false]
)

Binds a listener to an event.

Parameters:

  • event String

    Name of the event to bind to.

  • listener Function

    Function to execute.

  • [insertAtStart=false] Boolean optional

    Whether 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
)
private

Fires an update for the given event.

Parameters:

  • event String

    Event to fire

  • value Object

    Value to pass to the event listener(s).

  • originalEvent Event

    The original event from the browser

isSuspendEvents

() Boolean

Checks whether or not events are currently suspended.

Returns:

Boolean:

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 Object

    Object to perform replacements inside.

  • path String

    Path to use for replacements

  • value Object

    Value to set.

setSuspendEvents

(
  • val
)

Sets whether or not events are suspended.

Parameters:

  • val Boolean

    Whether or not to suspend events.

unbind

(
  • [event]
)

Clears either all listeners, or listeners for some specific event.

Parameters:

  • [event] String optional

    Constrains the clear to just listeners for this event.