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;
|
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
|
* @param object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user