Update index.js
This commit is contained in:
parent
06424aff14
commit
f320d9243a
|
@ -340,30 +340,6 @@ export function nativeToJSError(code: string, message: string, additionalProps?:
|
|||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO is this needed?
|
||||
* Prepends appName arg to all native method calls
|
||||
* @param appName
|
||||
* @param NativeModule
|
||||
*/
|
||||
export function nativeWithApp(appName: string, NativeModule: Object) {
|
||||
const native = {};
|
||||
const methods = Object.keys(NativeModule);
|
||||
|
||||
for (let i = 0, len = methods.length; i < len; i++) {
|
||||
const method = methods[i];
|
||||
if (isFunction(NativeModule[method])) {
|
||||
native[method] = (...args) => {
|
||||
return NativeModule[method](...[appName, ...args]);
|
||||
};
|
||||
} else {
|
||||
native[method] = NativeModule[method];
|
||||
}
|
||||
}
|
||||
|
||||
return native;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param object
|
||||
|
|
Loading…
Reference in New Issue