Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 815919 of remote/child

  • Revision slug: Mozilla/Add-ons/SDK/Low-Level_APIs/remote_child
  • Revision title: remote/child
  • Revision id: 815919
  • Created:
  • Creator: wbamberg
  • Is current revision? No
  • Comment

Revision Content

Unstable

Enables an SDK module loaded into a child process to communicate with modules in the main process.

Usage

The sdk/remote/parent module enables SDK code to load modules into child processes. The sdk/remote/child module is for these "child process modules". It provides two main things:

  • access to web content loaded into this child process
  • port mechanisms to communicate with the main process

See the documentation for sdk/remote/parent for more details.

Frame

A Frame represents a content frame in this process and provides a way to communicate frame specific events to the main process.

Properties

port

An event emitter that can be used to send and receive frame specific events to and from code in the main process.

content

The top level DOM window currently displaying in this frame.

isTab

A boolean property indicating if this frame displays in one of the application's main browser tabs.

Methods

addEventListener(event, listener, isCapturing)

Adds an event listener for DOM events dispatched by this content frame. This can include load and unload events from any content that is loaded in the frame. Listeners are automatically removed when this frame is destroyed.

removeEventListener(event, listener, isCapturing)

Removes an event listener that was previously registered.

Events

detach

Event emitted when this frame disconnects from the application.

Globals

Properties

process

A link to the main process

port

An event emitter that sends and receives events from the main process.

isRemote

A boolean property indicating whether this process is remote from the main process or not.

frames

A list of the content frames in this process. Each element in this list is a Frame. Listen to attach and detach events to hear as frames are created and destroyed.

port

An event emitter that sends and receives events from all frames.

forEvent(callback)

Calls the callback for every existing frame and any new frames created in the future. This is a shortcut for enumerating existing frames and then listening for attach events.

getFrameForWindow(window)

Finds the frame for a top level DOM window.

addEventListener(event, listener, isCapturing)

Adds an event listener for DOM events dispatched to any existing and future frames.

removeEventListene(event, listener, isCapturing)

Removes an event listener that was previously registered.

Revision Source

<div class="note">
<p>Unstable</p>
</div>

<p><span class="seoSummary">Enables an SDK module loaded into a child process to communicate with modules in the main process.</span></p>

<h2 id="Usage">Usage</h2>

<p>The&nbsp;<a href="/en-US/Add-ons/SDK/Low-Level_APIs/remote_parent"><code>sdk/remote/parent</code></a> module enables SDK code to load modules into child processes. The <code>sdk/remote/child</code> module is for these "child process modules". It provides two main things:</p>

<ul>
 <li>access to web content loaded into this child process</li>
 <li><code>port</code> mechanisms to communicate with the main process</li>
</ul>

<p>See the documentation for <a href="/en-US/Add-ons/SDK/Low-Level_APIs/remote_parent"><code>sdk/remote/parent</code></a> for more details.</p>

<h2 id="Frame_2"><a id="Frame" name="Frame">Frame</a></h2>

<p>A <code>Frame</code> represents a content frame in this process and provides a way to communicate frame specific events to the main process.</p>

<h3 id="Properties">Properties</h3>

<h4 id="port"><code>port</code></h4>

<p>An event emitter that can be used to send and receive frame specific events to and from code in the main process.</p>

<h4 id="content"><code>content</code></h4>

<p>The top level DOM window currently displaying in this frame.</p>

<h4 id="isTab"><code>isTab</code></h4>

<p>A boolean property indicating if this frame displays in one of the application's main browser tabs.</p>

<h3 id="Methods">Methods</h3>

<h4 id="addEventListener(event.2C_listener.2C_isCapturing)"><code>addEventListener(event, listener, isCapturing)</code></h4>

<p>Adds an event listener for DOM events dispatched by this content frame. This can include <code>load</code> and <code>unload</code> events from any content that is loaded in the frame. Listeners are automatically removed when this frame is destroyed.</p>

<h4 id="removeEventListener(event.2C_listener.2C_isCapturing)"><code>removeEventListener(event, listener, isCapturing)</code></h4>

<p>Removes an event listener that was previously registered.</p>

<h3 id="Events">Events</h3>

<h4 id="detach"><code>detach</code></h4>

<p>Event emitted when this frame disconnects from the application.</p>

<h2 id="Globals">Globals</h2>

<h3 id="Properties_2">Properties</h3>

<h4 id="process"><code>process</code></h4>

<p>A link to the main process</p>

<h5 id="port_2"><code>port</code></h5>

<p>An event emitter that sends and receives events from the main process.</p>

<h5 id="isRemote"><code>isRemote</code></h5>

<p>A boolean property indicating whether this process is remote from the main process or not.</p>

<h4 id="frames"><code>frames</code></h4>

<p>A list of the content frames in this process. Each element in this list is a <a href="#Frame">Frame</a>. Listen to <code>attach</code> and <code>detach</code> events to hear as frames are created and destroyed.</p>

<h5 id="port_3"><code>port</code></h5>

<p>An event emitter that sends and receives events from all frames.</p>

<h5 id="forEvent(callback)"><code>forEvent(callback)</code></h5>

<p>Calls the callback for every existing frame and any new frames created in the future. This is a shortcut for enumerating existing frames and then listening for attach events.</p>

<h5 id="getFrameForWindow(window)"><code>getFrameForWindow(window)</code></h5>

<p>Finds the frame for a top level DOM window.</p>

<h5 id="addEventListener(event.2C_listener.2C_isCapturing)_2"><code>addEventListener(event, listener, isCapturing)</code></h5>

<p>Adds an event listener for DOM events dispatched to any existing and future frames.</p>

<h5 id="removeEventListene(event.2C_listener.2C_isCapturing)"><code>removeEventListene(event, listener, isCapturing)</code></h5>

<p>Removes an event listener that was previously registered.</p>
Revert to this revision