
yarn
yarn build
cd examples
yarn
yarn start
- xcode open examples folder and build with simulator
Native inject global function into browser:
- nativeBridge.sendMessage
Web define two methods to window:
- window.webApp.callback
- window.webApp.dispatch
- Web dispatch
event
to native
hybrid.dispatch(event, params).then(console.log);
- Web handle native dispatch
event
const unsubscribe1 = hybrid.listen(event, callback);
const unsubscribe2 = hybrid.listen(event, callback);
- unsubscribe
event
unsubscribe1()
- Native dispatch
event
to web
webApp.dispatch(event, params);
- Native handle web dispatch
event
setTimeout(() => {
webApp.callBack(eventId, params);
});