Skip to content
  1. API
  2. Ogma
  3. events

Ogma.events

Events API module: listen to events triggered by the Ogma instance to add interactivity to your application.

ogma.events.off(listener)

Remove a listener from all events it was bound to.

Arguments

  • listener function

ogma.events.on(eventName, listener)

Listen to an event and call the listener function.

Arguments

  • eventName string|string[] Can be an event or an array of events
  • listener function

ogma.events.onEdgesClassAdded(className, listener)

Triggers the specified function when the specified class is added to some edges.

Arguments

  • className string
  • listener function(evt: {edges: EdgeList})

ogma.events.onEdgesClassRemoved(className, listener)

Triggers the specified function when the specified class is removed from some edges.

Arguments

  • className string
  • listener function(evt: {edges: EdgeList})

ogma.events.onKeyPress(key, listener)

Triggers the specified function when the specified key is pressed.

Arguments

  • key KeyName|KeyCode|Array<KeyName|KeyCode>|string Key to listen to. Multiple keys can be specified; in that case the function is triggered when the last key of the list is pressed, only if all the other keys are pressed.
  • listener function(evt: {domEvent: Event})

ogma.events.onNodesClassAdded(className, listener)

Triggers the specified function when the specified class is added to some nodes.

Arguments

  • className string
  • listener function(evt: {nodes: NodeList})

ogma.events.onNodesClassRemoved(className, listener)

Triggers the specified function when the specified class is removed from some nodes.

Arguments

  • className string
  • listener function(evt: {nodes: NodeList})

ogma.events.once(eventName, listener)

Listen to an event only once.

Arguments

  • eventName string|string[] Can be an event or an array of events
  • listener function