MCPcopy
hub / github.com/tldraw/tldraw / run

Method run

packages/utils/src/lib/ExecutionQueue.ts:77–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75 }
76
77 private async run() {
78 if (this.running) return
79 try {
80 this.running = true
81 while (this.queue.length) {
82 const task = this.queue.shift()!
83 await task()
84 if (this.timeout) {
85 await sleep(this.timeout)
86 }
87 }
88 } finally {
89 // this try/finally should not be needed because the tasks don't throw
90 // but better safe than sorry
91 // console.log('\n\n\nrunning false\n\n\n')
92 this.running = false
93 }
94 }
95
96 /**
97 * Adds a task to the queue and returns a promise that resolves with the task's result.

Callers 1

pushMethod · 0.95

Calls 1

sleepFunction · 0.90

Tested by

no test coverage detected