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.
Providers are usually being imported from
@aragon/api
or @aragon/wrapper
.import { providers } from '@aragon/api'
import { providers } from '@aragon/wrapper'
const providers = require('@aragon/api').providers
const providers = require('@aragon/wrapper').providers
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.
target
: The object (that implements the MessageChannel PostMessage API) to send messages to. (optional, defaultself
)
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.
Do you have a question? Leave your comments here at our Discourse forum 👇
Last modified 6mo ago