MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / Deferral

Class Deferral

Extension/src/LanguageServer/utils.ts:125–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123 * A class that delays the execution of a callback until a specified timeout period has elapsed.
124 */
125export class Deferral {
126 private timer?: NodeJS.Timeout;
127
128 constructor(callback: () => void, timeout: number) {
129 this.timer = setTimeout(() => {
130 this.timer = undefined;
131 callback();
132 }, timeout);
133 }
134 public cancel() {
135 if (this.timer) {
136 clearTimeout(this.timer);
137 this.timer = undefined;
138 }
139 }
140}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected