Capítulo 238 de 411

Chapter 238: Flip.batch()

Core Idea

Coordinates multiple independent Flip animations (e.g. across separate components) so all getState() calls happen first, then all DOM changes, then all animations — preventing one component's state change from corrupting another's captured state.

Reference Tables

ParameterTypeDescription
idStringunique id; returns the existing FlipBatch if one already exists for that id

Returns: a FlipBatch instance.

Code Examples

let batch = Flip.batch("myBatch");
// each component registers an action, then:
batch.run(); // runs all getState -> setState -> animate in the correct order

Key Takeaways

  1. Essential when multiple components each trigger their own Flip independently but their layouts affect each other (e.g. a shared flex/grid container).

Connects To

  • Flip.getState(), Flip.from(): the individual steps this batching coordinates across multiple actions.