vue-goody
v1.1.10
Published
`iframe.js` ```js const message = new Message({ channel: 'gm', targetChannel: 'panel', targetDirection: 'up', debug: true, }) message.route('getUi', (ctx) => { const config = store.state.gm.config const list = Object
Downloads
10
Readme
vue-goody
utils/Message
iframe.js
const message = new Message({
channel: 'gm',
targetChannel: 'panel',
targetDirection: 'up',
debug: true,
})
message.route('getUi', (ctx) => {
const config = store.state.gm.config
const list = Object.keys(config)
.filter((key) => config[key].changable)
.map((key) => {
let data = config[key]
return {
width: data.width,
height: data.height,
name: data.name,
url: getCdnUrl(data.url),
}
})
// ctx.responseError for error response
ctx.response({
list: list,
})
})
message.start()
message.iAmReady()
container.js
const message = new Message({
channel: 'panel',
targetChannel: 'gm',
targetDirection: 'down',
debug: true,
iframe: this.getIframe()
})
// iAmReady() called by iframe will trigger onReady of container
message.onReady(async () => {
const data = await this.message.request('getUi')
console.log('data from iframe', data)
})
message.start()