Skip to content

Commit

Permalink
Added "fetchBundle" global function
Browse files Browse the repository at this point in the history
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 452ac1b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Libraries/Core/InitializeCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 452ac1b

Please sign in to comment.