Skip to content

eles.emit(events, extraParams?)

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

eles.emit — Collection › Events

Preview · Collection › Events

Read in the complete API reference · All API members

// Emit an event on each element, bubbling through compound ancestors to the core
eles.emit(events: string, extraParams?: unknown[]): this

Emit an event on each element, bubbling through compound ancestors to the core.

Parameters
NameDescription
events: string

one or more space-separated event names

extraParams: unknown[]?

extra arguments passed to each handler after the event object

Returns this

this collection, for chaining

Example

cy.getElementById('a').one('example', event => console.log(event.type)); // "example"
cy.getElementById('a').emit('example'); // logs 'example'

Example graph and handle setup

Also spelled eles.trigger.