MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / watchUntilTrue

Function watchUntilTrue

packages/@stdlib/vue/src/vue.ts:41–67  ·  view source on GitHub ↗
(
  effect: (onCleanup: (cleanupFn: () => void) => void) => boolean,
)

Source from the content-addressed store, hash-verified

39}
40
41export function watchUntilTrue(
42 effect: (onCleanup: (cleanupFn: () => void) => void) => boolean,
43): Resolvable {
44 const resolvable = new Resolvable();
45
46 let unwatch: WatchStopHandle | null = null;
47
48 void resolvable.then(() => {
49 unwatch?.();
50 });
51
52 let result = false;
53
54 unwatch = watchEffect((onCleanup) => {
55 result = effect(onCleanup);
56
57 if (result) {
58 resolvable.resolve();
59 }
60 });
61
62 if (result) {
63 resolvable.resolve();
64 }
65
66 return resolvable;
67}

Callers 5

finishSetupMethod · 0.90
pasteMethod · 0.90
startMethod · 0.90
_dragOutMethod · 0.90
createMethod · 0.90

Calls 1

thenMethod · 0.95

Tested by

no test coverage detected