Class: Frame

Frame

Represents a way to interact with iframes. Facilitates discovery of current context (iframe or main window) as well as the ability to listen for frame-specific events.

Methods

(static) getCurrent() → {Promise.<_Frame>}

Asynchronously returns a reference to the current frame

Tutorials:
Returns:
Type
Promise.<_Frame>

(static) getCurrentSync() → {_Frame}

Synchronously returns a reference to the current frame

Tutorials:
Returns:
Type
_Frame

(async, static) wrap(identity) → {Promise.<_Frame>}

Asynchronously returns a reference to the specified frame. The frame does not have to exist

Parameters:
Name Type Description
identity Identity

the identity of the frame you want to wrap

Tutorials:
Returns:
Type
Promise.<_Frame>

(static) wrapSync(identity) → {_Frame}

Synchronously returns a reference to the specified frame. The frame does not have to exist

Parameters:
Name Type Description
identity Identity

the identity of the frame you want to wrap

Tutorials:
Returns:
Type
_Frame

addListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds the listener function to the end of the listeners array for the specified event type.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

Called whenever an event of the specified type occurs.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

getInfo() → {Promise.<FrameInfo>}

Returns a frame info object for the represented frame

Tutorials:
Returns:
Type
Promise.<FrameInfo>

getParentWindow() → {Promise.<FrameInfo>}

Returns a frame info object representing the window that the referenced iframe is currently embedded in

Tutorials:
Returns:
Type
Promise.<FrameInfo>

on(eventType, listener, optionsopt) → {Promise.<this>}

Adds a listener to the end of the listeners array for the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

Called whenever an event of the specified type occurs.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

once(eventType, listener, optionsopt) → {Promise.<this>}

Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

prependListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds a listener to the beginning of the listeners array for the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

prependOnceListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

removeAllListeners(eventTypeopt) → {Promise.<this>}

Removes all listeners, or those of the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol <optional>

The type of the event.

Tutorials:
Returns:
Type
Promise.<this>

removeListener(eventType, listener, optionsopt) → {Promise.<this>}

Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>