Providers
Last updated
Was this helpful?
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').providersA 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
target: The object (that implements the MessageChannel PostMessage API) to send messages to. (optional, default self)
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
Parameters
target: The object (that implements the Window PostMessage API) to send messages to.
Last updated
Was this helpful?
Was this helpful?
const provider = new WindowMessage(window.parent)