para-bridge-demo
Version:
a bridge api for js-ios/andriod rest
22 lines (20 loc) • 512 B
text/typescript
import { getPlatform, Platform } from 'para-utils';
/**
* consider the sign '_ntv' is unique
*/
const getAndroidBridgeMethods = () => {
const result: any = {};
for (const prop in window) {
if (window.hasOwnProperty(prop) && ~prop.indexOf('_ntv')) {
result[prop] = window[prop];
}
}
return result;
}
export const globalBridge = () => {
if (getPlatform() === Platform.FacAndroidWebview) {
return getAndroidBridgeMethods();
} else {
return require('./manifest-ios.json');
}
}