Skip to content

cy.endBatch()

cy.endBatch — Core > Graph manipulation > Batching and compaction. Cytoscape.js signatures, parameters and return contract.

cy.endBatch — Core › Graph manipulation › Batching and compaction

Preview · Core › Graph manipulation › Batching and compaction

Read in the complete API reference · All API members

// Close a batch
cy.endBatch(): this

Close a batch. Only the outermost close applies deferred styles and fires a batchend event. After that event, style reads reflect the completed batch. Nested closes and calls without an open batch do nothing.

batchend follows all element events and any patch summary produced by the batch. It carries no diff: listen to the events between batchstart and batchend to collect the changes.

Returns this

this core, for chaining

Example

cy.startBatch();
cy.getElementById('a').data('score', 5);
cy.endBatch();
console.log(cy.getElementById('a').data('score')); // 5

Example graph and handle setup