Skip to content

cy.promiseOn(events, predicate?)

cy.promiseOn — Core > Events. Cytoscape.js signatures, parameters and return contract.

cy.promiseOn — Core › Events

Preview · Core › Events

Read in the complete API reference · All API members

// Resolve once the next matching event fires — the promise form of one()
cy.promiseOn(events: string, predicate?: ElePredicate<NodeData, EdgeData>): Promise<Event<NodeData, EdgeData>>

Resolve once the next matching event fires — the promise form of one().

Parameters
NameDescription
events: string

one or more space-separated event names

predicate: ElePredicate<NodeData, EdgeData>?

an optional delegation predicate over the target

Returns Promise<Event<NodeData, EdgeData>>

a promise for the event object

Example

const next = cy.promiseOn('example');
cy.emit('example');
console.log((await next).type); // 'example'

Example graph and handle setup

Also spelled cy.pon.