JSDoc: Namespace: proxy

# Namespace: proxy

## proxy

Source:
  - proxy.js, line 37

### Classes

AsyncMessageChannel
SyncChromeSender

### Methods

#### (static) toChrome(sendSyncMessageFn)

Creates a transparent interface from the content- to the chrome context.

Calls to this object will be proxied via the frame's sendSyncMessage (`nsISyncMessageSender`) function. Since the message is synchronous, the return value is presented as a return value.

Example on how to use from a frame content script:

        let chrome = proxy.toChrome(sendSyncMessage.bind(this));
        let cookie = chrome.getCookie("foo");

##### Parameters:

Name | Type | Description
--- | --- | ---
`sendSyncMessageFn` | nsISyncMessageSender | The frame message manager's sendSyncMessage function.

Source:
  - proxy.js, line 417

#### (static) toChromeAsync(frameMessageManager)

A transparent content-to-chrome RPC interface where responses are presented as promises.

##### Parameters:

Name | Type | Description
--- | --- | ---
`frameMessageManager` | nsIFrameMessageManager | The content frame's message manager, which itself is usually an implementor of.

Source:
  - proxy.js, line 336

#### (static) toListener(mmFn, sendAsyncFn)

Creates a transparent interface between the chrome- and content contexts.

Calls to this object will be proxied via the message manager to a content frame script, and responses are returend as promises.

The argument sequence is serialised and passed as an array, unless it consists of a single object type that isn't null, in which case it's passed literally. The latter specialisation is temporary to achieve backwards compatibility with listener.js.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mmFn` | function | Closure function returning the current message manager.
`sendAsyncFn` | function | Callback for sending async messages.

Source:
  - proxy.js, line 56