Search…
Providers
A provider is used to send and receive messages between the wrapper and the app. This is required as apps are sandboxed in an iframe while the wrapper is running in the native context.

Import

Providers are usually being imported from @aragon/api or @aragon/wrapper.

ES6

import { providers } from '@aragon/api'
import { providers } from '@aragon/wrapper'

ES5 (CommonJS)

const providers = require('@aragon/api').providers
const providers = require('@aragon/wrapper').providers

MessagePortMessage

A provider communicates through the MessageChannel PostMessage API. It is suitable to use in background scripts since WebWorkers are natively compatible with the MessageChannel API.
Parameters
  1. 1.
    target: The object (that implements the MessageChannel PostMessage API) to send messages to. (optional, default self)

WindowMessage

A provider that communicates through the Window PostMessage API. It is suitable to use in front-ends connected through an iframe by passing window.parent.
Example
const provider = new WindowMessage(window.parent)
Parameters
  1. 1.
    ​target: The object (that implements the Window PostMessage API) to send messages to.
​
Do you have a question? Leave your comments here at our Discourse forum πŸ‘‡
Dev Support
Aragon Support Forum
Copy link
Outline
Import
MessagePortMessage
WindowMessage