Permalink
Browse files

Added "fetchBundle" global function

Reviewed By: jeanlauliac

Differential Revision: D5985425

fbshipit-source-id: 72de85d354e85b8f7d98c95d5aa5348484d26204
  • Loading branch information...
fromcelticpark authored and facebook-github-bot committed Oct 12, 2017
1 parent 7997a2b commit 452ac1b58e5eb5db470fbda9cfdbded277e92ccc
Showing with 20 additions and 0 deletions.
  1. +20 −0 Libraries/Core/InitializeCore.js
@@ -222,6 +222,26 @@ BatchedBridge.registerLazyCallableModule('RCTDeviceEventEmitter', () => require(
BatchedBridge.registerLazyCallableModule('RCTNativeAppEventEmitter', () => require('RCTNativeAppEventEmitter'));
BatchedBridge.registerLazyCallableModule('PerformanceLogger', () => require('PerformanceLogger'));
global.fetchBundle = function(
bundleId: number,
callback: (?Error) => void,
) {
const {BundleFetcher} = require('NativeModules');
if (!BundleFetcher) {
throw new Error('BundleFetcher is missing');
}
BundleFetcher.fetchBundle(bundleId, (errorObject: ?{message: string, code: string}) => {
if (errorObject) {
const error = new Error(errorObject.message);
(error: any).code = errorObject.code;
callback(error);
}
callback(null);
});
};
// Set up devtools
if (__DEV__) {
if (!global.__RCTProfileIsProfiling) {

0 comments on commit 452ac1b

Please sign in to comment.