summaryrefslogtreecommitdiff
path: root/core/lib.deno_core.d.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-11-16 20:23:12 +0100
committerGitHub <noreply@github.com>2021-11-16 20:23:12 +0100
commitfd78953e1c241c8dd14686631a2509aec97f1167 (patch)
tree8d9dcfbf5344dec48506e3100f88e042d7b7d2c7 /core/lib.deno_core.d.ts
parentb2036a4db71afd67a78f932528143fb07faea538 (diff)
feat(core): Deno.core.setNextTickCallback (#12771)
This commit adds several new "Deno.core" bindings: * "setNextTickCallback" * "hasScheduledTick" * "setHasScheduledTick" * "runMicrotasks" Additionally it changes "Deno.core.setMacrotaskCallback" to allow registering multiple callbacks. All these changes were necessary to polyfill "process.nextTick" in Node compat layer. Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'core/lib.deno_core.d.ts')
-rw-r--r--core/lib.deno_core.d.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/lib.deno_core.d.ts b/core/lib.deno_core.d.ts
index 4a5d6433b..f33f6164a 100644
--- a/core/lib.deno_core.d.ts
+++ b/core/lib.deno_core.d.ts
@@ -86,5 +86,26 @@ declare namespace Deno {
function setWasmStreamingCallback(
cb: (source: any, rid: number) => void,
): void;
+
+ /**
+ * Set a callback that will be called after resolving ops and before resolving
+ * macrotasks.
+ */
+ function setNextTickCallback(
+ cb: () => void,
+ ): void;
+
+ /** Check if there's a scheduled "next tick". */
+ function hasNextTickScheduled(): bool;
+
+ /** Set a value telling the runtime if there are "next ticks" scheduled */
+ function setHasNextTickScheduled(value: bool): void;
+
+ /**
+ * Set a callback that will be called after resolving ops and "next ticks".
+ */
+ function setMacrotaskCallback(
+ cb: () => bool,
+ ): void;
}
}