StringTune/Docs

API Reference

DOMBatcher

Advanced batching primitive for staged read, compute, and write work.

DOMBatcher

DOMBatcher is an advanced batching helper used by the runtime when initializing or processing many objects.

Public status

DOMBatcher is exported by the package root, but it is advanced surface rather than everyday API.

What it does

It separates queued work into three lanes:

  • read
  • compute
  • write

Each lane is processed in order, and each task can carry a priority.

Main methods

  • scheduleRead(task, priority?)
  • scheduleCompute(task, priority?)
  • scheduleWrite(task, priority?)
  • batchModuleInitialization(contexts)
  • flushSync()
  • clear()

Runtime role

In the current runtime it is used by ObjectManager to batch module initialization:

  1. read rects and dimensions
  2. run initializeObject(...)
  3. run calculatePositions(...)
  4. run connectObject(...) and addObject(...)

Cached data

During a batch it also keeps temporary caches for:

  • element rects
  • element dimensions

Those caches are cleared after the batch flushes.

When to use it

Only use it when:

  • you are building an advanced custom module
  • you are processing many elements in one burst
  • you have already measured that normal lifecycle batching is not enough

Practical note

Most custom modules do not need their own DOMBatcher. The runtime already gives you enough batching through lifecycle phases and object initialization.