amber/web

Types

pub type Date

Values

pub fn alert(message: String) -> Nil
pub fn clear_interval(id: Int) -> Nil
pub fn clear_timeout(id: Int) -> Nil

Cancels a scheduled action initiated by set_timeout.

Examples

let id = web.set_timeout(500, fn() { io.println("hello") })
// ...
web.clear_timeout(id)
pub fn close() -> Nil
pub fn confirm(message: String) -> Bool
pub fn prompt(message: String, default: String) -> Option(String)
pub fn queue_microtask(func: fn() -> Nil) -> Nil

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.

web.queue_microtask(fn() { io.println("This event loop stack is complete") })
pub fn report_error(error: a) -> Nil
pub fn set_interval(delay: Int, callback: fn() -> Nil) -> Int
pub fn set_timeout(delay: Int, callback: fn() -> Nil) -> Int

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.

Examples

web.set_timeout(500, fn() { io.println("hello") })
Search Document