ScramjetFrame
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:44
An abstraction over proxy iframe creation, which lets you manage instances of Scramjet and not have to worry about the proxy internals, since everything you need is already proxified.
Example
Section titled “Example”const { ScramjetController } = $scramjetLoadController();
const scramjet = new ScramjetController({ prefix: "/scramjet/" });
await scramjet.init();
const frame = scramjet.createFrame();
document.body.appendChild(frame.frame);
// Navigate to a URL
frame.go("https://example.com");
// Listen for proxified navigation events
frame.addEventListener("urlchange", (e) => {
console.log("URL changed to:", e.url);
});
// Go back
frame.back();
// Go forward
frame.forward();
// Reload page
frame.reload();
Extends
Section titled “Extends”EventTarget
Properties
Section titled “Properties”frame:
HTMLIFrameElement
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:54
The frame to be controlled for you under Scramjet.
Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client():
ScramjetClient
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:66
Returns the ScramjetClient instance running inside the iframe’s contentWindow.
Returns
Section titled “Returns”The ScramjetClient
instance.
Get Signature
Section titled “Get Signature”get url():
URL
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:75
Returns the proxified URL.
Returns
Section titled “Returns”URL
The proxified URL.
Methods
Section titled “Methods”addEventListener()
Section titled “addEventListener()”addEventListener<
K
>(type
,listener
,options?
):void
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:139
Binds event listeners to listen for proxified navigation events in Scramjet.
Type Parameters
Section titled “Type Parameters”K
extends keyof ScramjetEvents
Parameters
Section titled “Parameters”K
Type of event to listen for.
listener
Section titled “listener”(event
) => void
Event listener to dispatch.
options?
Section titled “options?”Options for the event listener.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”// Listen for URL changes
frame.addEventListener("urlchange", (event) => {
console.log("URL changed:", event.url);
document.title = event.url; // Update page title
});
// Listen for navigation events
frame.addEventListener("navigate", (event) => {
console.log("Navigating to:", event.url);
});
Overrides
Section titled “Overrides”EventTarget.addEventListener
back()
Section titled “back()”back():
void
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:100
Goes backwards in the browser history.
Returns
Section titled “Returns”void
dispatchEvent()
Section titled “dispatchEvent()”Call Signature
Section titled “Call Signature”dispatchEvent(
event
):boolean
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.dom.d.ts:11575
The dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Parameters
Section titled “Parameters”Event
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”EventTarget.dispatchEvent
Call Signature
Section titled “Call Signature”dispatchEvent(
event
):boolean
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.webworker.d.ts:4019
The dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Parameters
Section titled “Parameters”Event
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”EventTarget.dispatchEvent
forward()
Section titled “forward()”forward():
void
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:107
Goes forward in the browser history.
Returns
Section titled “Returns”void
go(
url
):void
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:89
Navigates the iframe to a new URL under Scramjet.
Parameters
Section titled “Parameters”A real URL to navigate to
string
| URL
Returns
Section titled “Returns”void
Example
Section titled “Example”frame.go("https://example.net");
reload()
Section titled “reload()”reload():
void
Defined in: typedoc-repos/scramjet/src/controller/frame.ts:114
Reloads the iframe.
Returns
Section titled “Returns”void
removeEventListener()
Section titled “removeEventListener()”Call Signature
Section titled “Call Signature”removeEventListener(
type
,callback
,options?
):void
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.dom.d.ts:11581
The removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Parameters
Section titled “Parameters”string
callback
Section titled “callback”EventListenerOrEventListenerObject
options?
Section titled “options?”boolean
| EventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”EventTarget.removeEventListener
Call Signature
Section titled “Call Signature”removeEventListener(
type
,callback
,options?
):void
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.webworker.d.ts:4025
The removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Parameters
Section titled “Parameters”string
callback
Section titled “callback”EventListenerOrEventListenerObject
options?
Section titled “options?”boolean
| EventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”EventTarget.removeEventListener