MCPcopy Create free account
hub / github.com/Effect-TS/effect / armInterval

Function armInterval

packages/effect/src/ui/Query.ts:5782–5803  ·  view source on GitHub ↗
(entry: Entry)

Source from the content-addressed store, hash-verified

5780 if (build !== undefined) ensureFetch(entry, "interval", build)
5781 }
5782 const armInterval = (entry: Entry): void => {
5783 if (entry.intervalCancel !== undefined) entry.intervalCancel()
5784 entry.intervalCancel = undefined
5785 if (entry.intervalDue === undefined) return
5786 const remaining = entry.intervalDue - now()
5787 if (remaining <= 0) {
5788 let cancelled = false
5789 entry.intervalCancel = () => {
5790 cancelled = true
5791 }
5792 defer(() => {
5793 if (cancelled) return
5794 entry.intervalCancel = undefined
5795 fireInterval(entry)
5796 })
5797 return
5798 }
5799 entry.intervalCancel = timer(remaining, () => {
5800 entry.intervalCancel = undefined
5801 fireInterval(entry)
5802 })
5803 }
5804 /** Counts from the last settle. Called at a settle and at the zero-to-one watch. */
5805 const scheduleInterval = (entry: Entry): void => {
5806 stopInterval(entry)

Callers 4

scheduleIntervalFunction · 0.85
rearmIntervalFunction · 0.85
settleRunEntryFunction · 0.85
edgePassFunction · 0.85

Calls 4

fireIntervalFunction · 0.85
nowFunction · 0.70
deferFunction · 0.70
timerFunction · 0.70

Tested by

no test coverage detected