if ("scheduler" in this) {
// Post task with default priority: 'user-visible' (no other options)
// When the task resolves, Promise.then() logs the result.
scheduler
.postTask(() => "Task executing")
.then((taskResult) => console.log(`${taskResult}`)) // Log result
.catch((error) => console.error(`Error: ${error}`)); // Log errors
}Scheduler / notebook
Scheduler
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.