u-jsbridge
v0.2.3
Published
app js bridge
Downloads
12
Readme
u-jsbridge
App js bridge
Install
use npm
npm install u-jsbridge --save
Usage
import jsBridge from 'u-jsbridge';
Demo
send a bridge call to native app
jsBridge.call('testMessage', (response) => {
// here process response data from native app
});
// call bridge with data
jsBridge.call('testMessage', { userName: 'tom' }, (response) => {
// here process response data from native app
});
register bridge response process handler
jsBridge.register('sendMessage', (response) => {
});
emit simulated bridge response event
jsBridge.emit('testMessage', {
msgType: 'testMessage',
data: {
info: 'hello world'
}
});
switch debugger mode status
jsBridge.setDebuggerMode(true);
API
jsBridge
- setDebuggerMode(boolean[default: false])
- call(bridgeName, [data], [callBack])
- register(bridgeName, callback)
- emit(bridgeName, response)