Skip to content

layout.promise()

layout.promise — Layouts > Layout handle. Cytoscape.js signatures, parameters and return contract.

layout.promise — Layouts › Layout handle

Preview · Layouts › Layout handle

Read in the complete API reference · All API members

// Resolves at this run's layoutstop (immediately when never run); rejects with CancelledError when the run was cancelled — by cancel() or by cy.destroy()
layout.promise(): Promise<void>

Resolves at this run's layoutstop (immediately when never run); rejects with CancelledError when the run was cancelled — by cancel() or by cy.destroy().

Returns Promise<void>

the run's promise

Example

layout.run();
await layout.promise();
console.log(cy.getElementById('b').position('x')); // 40

Example graph and handle setup