Remote procedure call system to communicate with iframes.
Explicit is better than implicit.
npm install --save postling
import Postling from 'postling'
const postling = new Postling()
if (Object.keys(postling.methods).length === 0) {
postling.methods.forEach((method) => {
postling.methods[method]().then((result) => {
console.log(`[${method}] - `, result);
}).catch(::console.error)
})
}
- simple RPC interface for
postMessage
communication - promise interface
- perhaps keep a (global) queue for the initial invocation instead of fetching them (?)
- use proper a
Proxy
object as the support and browser adaption is growing