Skip to content

eles.off(events, callback?)

eles.off — Collection > Events. Cytoscape.js signatures, parameters and return contract.

eles.off — Collection › Events

Preview · Collection › Events

Read in the complete API reference · All API members

// Stop listening on each element of this collection
eles.off(events: string, callback?: EventHandler<NodeData, EdgeData>): this

Stop listening on each element of this collection.

Parameters
NameDescription
events: string

one or more space-separated event names

callback: EventHandler<NodeData, EdgeData>?

the handler to remove; omit to remove every handler these elements have for events

Returns this

this collection, for chaining

Example

let count = 0;
const handler = () => count++;
cy.getElementById('a').on('example', handler);
cy.getElementById('a').off('example', handler);
cy.getElementById('a').emit('example');
console.log(count); // 0

Example graph and handle setup

Also spelled eles.removeListener.