Import with #import "std/web".
WebValue :: struct { tag: s32; aux: s32; number: float64; }A value crossing the boundary: a tag, a length or handle, and a number.
WebUndefinedTag :: 0WebNullTag :: 1WebBoolTag :: 2WebNumberTag :: 3WebTextTag :: 4WebObjectTag :: 5WebStringTag :: 6WebGlobal :: 1WebModule :: 2WebBytesUint8 :: 0The kinds of typed array WebBytes builds.
WebBytesUint8Clamped :: 1WebBytesInt16 :: 2WebBytesInt32 :: 3WebBytesFloat32 :: 4WebTypeUndefined :: 0What WebTypeOf reports.
WebTypeNull :: 1WebTypeBool :: 2WebTypeNumber :: 3WebTypeString :: 4WebTypeObject :: 5WebTypeFunction :: 6Receives a JS function's first three arguments as handles that are valid
WebCallback :: #type (context: s32, first: s32, second: s32, third: s32)web_failed: boolWebName :: (text: string) -> s32Interns a name for property and method access. Do this once per name.
WebUndefined :: () -> WebValueWebNull :: () -> WebValueWebBool :: (value: bool) -> WebValueWebNumber :: (value: float64) -> WebValueWebText :: (text: string) -> WebValueThe text is read while the call it is passed to runs, so it must stay alive until then.
WebObject :: (handle: s32) -> WebValueWebAsNumber :: (value: WebValue) -> float64WebAsBool :: (value: WebValue) -> boolWebAsObject :: (value: WebValue) -> s32The handle of an object or string result, or 0.
WebIsUndefined :: (value: WebValue) -> boolWebFailed :: () -> boolWhether the last property access, call, or construction threw. The exception is WebLastError.
WebLastError :: () -> s32WebGet :: (object: s32, name: s32) -> WebValueWebGetNumber :: (object: s32, name: s32) -> float64WebGetObject :: (object: s32, name: s32) -> s32WebSet :: (object: s32, name: s32, value: WebValue)WebAt :: (object: s32, index: s32) -> WebValueWebSetAt :: (object: s32, index: s32, value: WebValue)WebCall :: (object: s32, name: s32, args: *WebValue, count: s32) -> WebValueWebCall0 :: (object: s32, name: s32) -> WebValueWebCall1 :: (object: s32, name: s32, a: WebValue) -> WebValueWebCall2 :: (object: s32, name: s32, a: WebValue, b: WebValue) -> WebValueWebCall3 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue) -> WebValueWebCall4 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue) -> WebValueWebCall5 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue) -> WebValueWebCall6 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue, f: WebValue) -> WebValueWebCall8 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue, f: WebValue, g: WebValue, h: WebValue) -> WebValueWebNew :: (constructor: s32, args: *WebValue, count: s32) -> s32Constructs `new constructor(args...)`; returns the new object's handle.
WebNew0 :: (constructor: s32) -> s32WebNew1 :: (constructor: s32, a: WebValue) -> s32WebNew2 :: (constructor: s32, a: WebValue, b: WebValue) -> s32WebNew3 :: (constructor: s32, a: WebValue, b: WebValue, c: WebValue) -> s32WebValueOf :: (handle: s32) -> WebValueThe value a handle holds, such as the number a callback argument carries.
WebNewObject :: () -> s32WebNewArray :: () -> s32WebRelease :: (handle: s32)Frees a handle made by WebKeep or WebFunction. Temporary handles need no release.
WebScope :: () -> s32Starts a scope; WebEnd(mark) frees every temporary handle made since.
WebEnd :: (mark: s32)WebKeep :: (handle: s32) -> s32A handle to the same object that lasts until WebRelease, unlike the temporary one it came from.
WebLiveHandles :: () -> s32How many handles are live, for checking a program does not leak them.
WebTypeOf :: (handle: s32) -> s32WebInstanceOf :: (handle: s32, constructor: s32) -> boolWebFunction :: (callback: WebCallback, context: s32) -> s32A JS function that runs `callback` with `context` and up to three argument handles, kept until released.
WebStringLength :: (handle: s32) -> s32The length in bytes of a string handle's text.
WebCopyString :: (handle: s32, buffer: []u8) -> s32Copies a string handle's text into `buffer`, NUL-terminated, and returns its length in bytes.
WebBytes :: (kind: s32, data: *void, count: s32) -> s32A typed array holding a copy of `count` elements from `data`.
WebBlobBytes :: (data: *void, count: s32) -> s32A Blob snapshot of `count` bytes from `data`, or 0 for an invalid range. The browser snapshots the Wasm view within this one host call: callers may change/free the source or grow memory as soon as this returns. This avoids the extra encoded-byte copy of WebBytes followed by a Blob constructor. Useful for files, downloads, media and request bodies; MIME may be supplied later with the ordinary Blob.slice API. WebBytes keeps its copy semantics.
WebCopyOut :: (handle: s32, data: *void, capacity: s32) -> s32Copies a typed array's bytes into `data`, at most `capacity`; returns the number copied.
WebCopyIn :: (handle: s32, data: *void, length: s32) -> s32Copies `length` bytes from `data` over the start of a typed array.
WebAwait :: (promise: s32, result: *WebValue) -> boolSuspends until the promise settles. Returns whether it resolved, with its value in `result`.
WebSleep :: (milliseconds: s32)WebNextFrame :: (minimum_delay: float64)Suspends until the browser draws its next frame, and at least `minimum_delay` milliseconds have passed.