Transport used on the page loaded inside an iframe. Inherits the interface EventEmitter.
iframe
import {Consumer} from 'magic-transport'const id = 'UNIQ_ID'const parentOrigin = '*'const sharedObject = { hello: { from: { consumer() { return transport.provider.hello.from.provider() } } }, timeout(callback, timeout) { setTimeout(() => { callback('hello from consumer') }, timeout) }}const transport = new Consumer({id, parentOrigin, ...sharedObject})transport.once('ready', () => { // Transport is ready to use}) Copy
import {Consumer} from 'magic-transport'const id = 'UNIQ_ID'const parentOrigin = '*'const sharedObject = { hello: { from: { consumer() { return transport.provider.hello.from.provider() } } }, timeout(callback, timeout) { setTimeout(() => { callback('hello from consumer') }, timeout) }}const transport = new Consumer({id, parentOrigin, ...sharedObject})transport.once('ready', () => { // Transport is ready to use})
The provider facade.
The consumer facade.
Creates a new Consumer instance.
Consumer
Generated using TypeDoc
Transport used on the page loaded inside an
iframe
. Inherits the interface EventEmitter.