Skip to main content
Platform - Web documentation

Functions

f
alert
Shows the given message and waits for the enter key pressed. If the stdin is not interactive, it does nothing.
f
clearInterval
Cancels a timed, repeating action which was previously started by a call to `setInterval()` ```ts const id = setInterval(() => {console.log('hello');}, 500); // ... clearInterval(id); ```
f
clearTimeout
Cancels a scheduled action initiated by `setTimeout()` ```ts const id = setTimeout(() => {console.log('hello');}, 500); // ... clearTimeout(id); ```
f
close
No documentation available
f
confirm
Shows the given message and waits for the answer. Returns the user's answer as boolean. Only `y` and `Y` are considered as true. If the stdin is not interactive, it returns false.
f
prompt
Shows the given message and waits for the user's input. Returns the user's input as string. If the default value is given and the user inputs the empty string, then it returns the given default value. If the default value is not given and the user inputs the empty string, it returns the empty string. If the stdin is not interactive, it returns null.
f
queueMicrotask
A microtask is a short function which is executed after the function or module which created it exits and only if the JavaScript execution stack is empty, but before returning control to the event loop being used to drive the script's execution environment. This event loop may be either the main event loop or the event loop driving a web worker. ```ts queueMicrotask(() => { console.log('This event loop stack is complete'); }); ```
f
reportError
Dispatch an uncaught exception. Similar to a synchronous version of: ```ts setTimeout(() => { throw error; }, 0); ``` The error can not be caught with a `try/catch` block. An error event will be dispatched to the global scope. You can prevent the error from being reported to the console with `Event.prototype.preventDefault()`: ```ts addEventListener("error", (event) => { event.preventDefault(); }); reportError(new Error("foo")); // Will not be reported. ``` In Deno, this error will terminate the process if not intercepted like above.
f
setInterval
Repeatedly calls a function , with a fixed time delay between each call. ```ts // Outputs 'hello' to the console every 500ms setInterval(() => { console.log('hello'); }, 500); ```
f
setTimeout
Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns an id which may be used to cancel the timeout. ```ts setTimeout(() => { console.log('hello'); }, 500); ```
f
structuredClone
Creates a deep copy of a given value using the structured clone algorithm. Unlike a shallow copy, a deep copy does not hold the same references as the source object, meaning its properties can be changed without affecting the source. For more details, see [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Deep_copy). Throws a `DataCloneError` if any part of the input value is not serializable.

Interfaces

Type Aliases

Variables

v
closed
No documentation available
v
location
No documentation available
v
name
No documentation available
v
navigator
No documentation available
v
self
No documentation available
v
window
No documentation available