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

Function unsafeSchedule

packages/effect/src/internal/clock.ts:22–38  ·  view source on GitHub ↗
(task: Clock.Task, duration: Duration.Duration)

Source from the content-addressed store, hash-verified

20/** @internal */
21export const globalClockScheduler: Clock.ClockScheduler = {
22 unsafeSchedule(task: Clock.Task, duration: Duration.Duration): Clock.CancelToken {
23 const millis = Duration.toMillis(duration)
24 // If the duration is greater than the value allowable by the JS timer
25 // functions, treat the value as an infinite duration
26 if (millis > MAX_TIMER_MILLIS) {
27 return constFalse
28 }
29 let completed = false
30 const handle = setTimeout(() => {
31 completed = true
32 task()
33 }, millis)
34 return () => {
35 clearTimeout(handle)
36 return !completed
37 }
38 }
39}
40
41const performanceNowNanos = (function() {

Callers

nothing calls this directly

Calls 1

taskFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…