Skip to main content
Scramjet provides typed events for navigation, downloads, and context initialization.

Global events

Events dispatched on the ScramjetController instance.

ScramjetGlobalEvents

Map of all global Scramjet events with their corresponding event types.

ScramjetGlobalEvent

Union type for all global Scramjet events.

ScramjetGlobalDownloadEvent

Event class for proxified download interception.
ScramjetDownload
required
The download object containing file information

Example

ScramjetDownload

Object representing a proxified download.
string
The suggested filename for the download (may be undefined)
string
required
The URL of the resource being downloaded
string
required
The MIME type of the download
ReadableStream<Uint8Array>
required
The readable stream containing the download data
number
required
The content length in bytes

Frame events

Events dispatched on ScramjetFrame instances.

ScramjetEvents

Map of all Scramjet navigation events with their corresponding event types.

ScramjetEvent

Union type for all Scramjet proxified navigation events.
Navigation event class fired when a Scramjet frame navigates to a new proxified URL.
string
required
The real URL being navigated to

Example

Call event.preventDefault() to prevent the navigation from occurring.

UrlChangeEvent

URL change event class fired when the proxified URL changes in a Scramjet frame.
string
required
The new URL after the change

Example

This event fires after navigation completes, including history API usage.

ScramjetContextEvent

Event class fired when Scramjet initializes in a frame.
Self
required
The global object (window or worker) where Scramjet was initialized
ScramjetClient
required
The ScramjetClient instance for this context

Example

Complete example