MCPcopy
hub / github.com/tldraw/tldraw / promiseWithResolve

Function promiseWithResolve

packages/utils/src/lib/control.ts:231–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229 * @internal
230 */
231export function promiseWithResolve<T>(): Promise<T> & {
232 resolve(value: T): void
233 reject(reason?: any): void
234} {
235 let resolve: (value: T) => void
236 let reject: (reason?: any) => void
237 const promise = new Promise<T>((res, rej) => {
238 resolve = res
239 reject = rej
240 })
241 return Object.assign(promise, {
242 resolve: resolve!,
243 reject: reject!,
244 })
245}
246
247/**
248 * Create a Promise that resolves after a specified delay.

Callers 14

control.test.tsFile · 0.90
getSvgJsxFunction · 0.90
signalizeQueryMethod · 0.90
constructorMethod · 0.90
bootMethod · 0.90
connectMethod · 0.90
UserDataSyncerClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…