From 9c6765d5cf697b5cb2fcda3d21bb2c2985ecdaf9 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 5 Sep 2017 15:47:54 -0700 Subject: [PATCH] Document ThrottledOperations.schedule --- src/server/utilities.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 700a1e12fe..cde6329bf0 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -179,6 +179,12 @@ namespace ts.server { constructor(private readonly host: ServerHost) { } + /** + * Wait `number` milliseconds and then invoke `cb`. If, while waiting, schedule + * is called again with the same `operationId`, cancel this operation in favor + * of the new one. (Note that the amount of time the canceled operation had been + * waiting does not affect the amount of time that the new operation waits.) + */ public schedule(operationId: string, delay: number, cb: () => void) { const pendingTimeout = this.pendingTimeouts.get(operationId); if (pendingTimeout) {