MCPcopy Index your code
hub / github.com/material-shell/material-shell / schedule

Method schedule

src/utils/async.ts:64–80  ·  view source on GitHub ↗

Call `f` in about `delayMs` milliseconds. * If this function is called multiple times before `f` runs, `f` will still only be called once. * * If `schedule` is called while `f` is running (it is asynchronous) then `f` will be called again * as soon as `f` has finished its current

()

Source from the content-addressed store, hash-verified

62 * See https://docs.gtk.org/glib/main-loop.html
63 */
64 schedule() {
65 if (this.running) {
66 this.runAgain = true;
67 } else if (this.timeoutId === undefined) {
68 this.timeoutId = Async.addTimeout(
69 GLib.PRIORITY_DEFAULT,
70 this.delayMs,
71 () => {
72 // Note: need to manually catch exceptions in async functions, otherwise they will not be logged
73 this.runInternal().catch(logAsyncException);
74 return GLib.SOURCE_REMOVE;
75 }
76 );
77 } else {
78 // Already scheduled and not running. We can just sit back and wait.
79 }
80 }
81
82 private async runInternal() {
83 assert(

Callers 6

runInternalMethod · 0.95
vfunc_allocateMethod · 0.45
vfunc_allocateMethod · 0.45
onNewMetaWindowMethod · 0.45
openAppForMsWindowMethod · 0.45

Calls 2

runInternalMethod · 0.95
addTimeoutMethod · 0.80

Tested by

no test coverage detected