MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeBatched

Function makeBatched

packages/effect/src/Scheduler.ts:325–336  ·  view source on GitHub ↗
(
  callback: (runBatch: () => void) => void,
  shouldYield: Scheduler["shouldYield"] = defaultShouldYield
)

Source from the content-addressed store, hash-verified

323 * @category constructors
324 */
325export const makeBatched = (
326 callback: (runBatch: () => void) => void,
327 shouldYield: Scheduler["shouldYield"] = defaultShouldYield
328) => {
329 const getRunner = SchedulerRunner.cached((_, drain) => {
330 callback(() => drain(0))
331 })
332
333 return make((task, priority, fiber) => {
334 getRunner(fiber).scheduleTask(task, priority)
335 }, shouldYield)
336}
337
338/**
339 * @since 2.0.0

Callers 2

timerBatchedFunction · 0.70
layerBatchedFunction · 0.50

Calls 4

cachedMethod · 0.80
makeFunction · 0.70
scheduleTaskMethod · 0.65
drainFunction · 0.50

Tested by

no test coverage detected