ScramjetModule
Interface for Scramjet modules that hook into browser APIs.Properties
(client: ScramjetClient) => boolean | undefined
Optional function that returns whether the module should be enabled for the given client.
(client: ScramjetClient, self: typeof globalThis) => void | undefined
Optional function called when the module is disabled.
number
Optional loading order. Lower numbers load first. Default: 0
(client: ScramjetClient, self: typeof globalThis) => void
required
The main module function that applies hooks and modifications.
Example
Proxy
Handler type for proxying functions and constructors.Properties
(ctx: ProxyCtx) => any
Handler for constructor calls (when using
new)(ctx: ProxyCtx) => any
Handler for function calls
Example
ProxyCtx
Context object passed to proxy handlers.Properties
Function
required
The original function or constructor being called
any
required
The
this context for the callany[]
required
The arguments array. You can modify this before calling.
Function
required
The constructor that was originally called (for construct handlers)
(r: any) => void
required
Function to return a value early without calling the original
() => any
required
Function to call the original function/constructor with the (possibly modified) arguments
Trap
Handler type for trapping property access.Properties
boolean
Whether the property is writable
any
Static value for the property
boolean
Whether the property shows up in enumeration
boolean
Whether the property descriptor can be changed
(ctx: TrapCtx<T>) => T
Getter function for the property
(ctx: TrapCtx<T>, v: T) => void
Setter function for the property
Example
TrapCtx
Context object passed to trap handlers.Properties
any
required
The
this context for the property access() => T
required
Function to get the original property value
(v: T) => void
required
Function to set the original property value