Skip to Content
Documentation

songstress/sandbox

The globals an entry's code finds in the sandbox, for the compiler.

songstress/sandbox exports nothing to import: it declares the globals an entry's code finds in Songstress's sandbox, and nothing more. Name it in your extension's tsconfig.json, and code that reaches for fetch, process, window or document does not compile, which is the truth: they are not there. The way to the network is songstress.net.fetch.

tsconfig.json
{ "compilerOptions": { "lib": ["ES2023"], "types": ["songstress/sandbox"] } }

Each global, and every description, is read from the SDK's sandbox.d.ts when the site is built.

Console

The extension's log: songstress dev prints it, and the server keeps the last of it for its admin.

Prop

Type

console

The extension's log.

declare var console: Console

setTimeout

Calls handler once, after ms milliseconds. A timer does not keep a call alive past the promise its handler returned.

declare function setTimeout(handler: (...args: never[]) => void, ms?: number, ...args: unknown[]): number
ParameterTypeDescription
handler(...args: never[]) => voidWhat to call.
ms?numberHow long to wait, in milliseconds.
...argsunknown[]What handler is called with.

Returns number: The timer's id, for clearTimeout.

setInterval

Calls handler every ms milliseconds, until clearInterval. Like every timer, it does not keep a call alive past the promise its handler returned.

declare function setInterval(handler: (...args: never[]) => void, ms?: number, ...args: unknown[]): number
ParameterTypeDescription
handler(...args: never[]) => voidWhat to call.
ms?numberHow long between calls, in milliseconds.
...argsunknown[]What handler is called with.

Returns number: The timer's id, for clearInterval.

clearTimeout

Stops a timer setTimeout set.

declare function clearTimeout(id: number | undefined): void
ParameterTypeDescription
idnumber | undefinedThe timer's id.

Returns void.

clearInterval

Stops a timer setInterval set.

declare function clearInterval(id: number | undefined): void
ParameterTypeDescription
idnumber | undefinedThe timer's id.

Returns void.