World widget

WIT interface for the interaction between the host application and widgets Inspired by work-in-progress WASI Preview 2 WIT definitions (https://github.com/bytecodealliance/preview2-prototyping/tree/main/wit)

Import interface widget:widget/http

HTTP interface for widgets. Allows them to make HTTP/HTTPS requests.


Types

type status

u16

#### `variant method`

Variant Cases

record response

Record Fields

Functions

request: func

Params
Return values

Import interface widget:widget/random


Functions

get-random: func

Returns a random number generated by a cryptographically secure pseudorandom number generator (CSPRNG)

Return values

Import interface widget:widget/types


Types

record datetime

Record Fields

record widget-context

Configuration that the widget receives from the host.

Record Fields

record widget-result

The result of a widget invocation.

Record Fields

Import interface widget:widget/clocks


Types

type datetime

datetime

----

Functions

now: func

Return values

Import interface widget:widget/logging

Allows widgets to write logs to the host


Types

enum level

Enum Cases

Functions

log: func

Params

Exported types from world widget


Types

type widget-context

widget-context

#### `type widget-result` [`widget-result`](#widget_result)

## Exported functions from world `widget`

get-name: func

Return the name of the widget

Return values

get-version: func

Return the semantic version of the widget

Return values

get-config-schema: func

Return the config JSON schema string

Return values

get-run-update-cycle-seconds: func

Returns the run update cycle in seconds. With this, widgets can control how frequently they shall be updated.

Return values

run: func

Invoke the widget with the given context

Params
Return values