Skip to content

whatwg6/Hybrid-JS-SDK

Repository files navigation

Hybrid JS-SDK

截屏2025-05-10 13 25 13

Examples

Install

yarn
yarn build

cd examples

yarn
yarn start

Xcode build

  • xcode open examples folder and build with simulator

Core

Web -> Native

Native inject global function into browser:

  • nativeBridge.sendMessage

Native -> Web

Web define two methods to window:

  • window.webApp.callback
  • window.webApp.dispatch

API

Web -> Native

examples/src/index.js

  • 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 -> Web

examples/src/index.js

  • Native dispatch event to web
webApp.dispatch(event, params);
  • Native handle web dispatch event
setTimeout(() => {
  webApp.callBack(eventId, params);
});

About

Hybrid JS-SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •