From a6fb1a9d8698529ac13c8cbcce9eaf440ac3faeb Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 18 Jul 2019 02:45:01 -0700 Subject: [PATCH] Add prefetcher mercurial setup code Summary: Logic for installing an uninstalling a custom `post-update` mercurial hook, invoking the script introduced in the previous diff. This is to gather some early data before rolling this integration out more broadly, i.e. through the mercurial distribution. Reviewed By: jknoxville Differential Revision: D16283081 fbshipit-source-id: e8610509e5f105a9b717a881aa327bb04f9a2f4f --- src/fb-stubs/Prefetcher.js | 8 ++++++++ src/init.js | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 src/fb-stubs/Prefetcher.js diff --git a/src/fb-stubs/Prefetcher.js b/src/fb-stubs/Prefetcher.js new file mode 100644 index 000000000..a22293de3 --- /dev/null +++ b/src/fb-stubs/Prefetcher.js @@ -0,0 +1,8 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +export default async function setupPrefetcher() {} diff --git a/src/init.js b/src/init.js index 62c0ec3c7..1e0b59909 100644 --- a/src/init.js +++ b/src/init.js @@ -13,6 +13,7 @@ import GK from './fb-stubs/GK.js'; import {init as initLogger} from './fb-stubs/Logger'; import App from './App.js'; import BugReporter from './fb-stubs/BugReporter.js'; +import setupPrefetcher from './fb-stubs/Prefetcher.js'; import {createStore} from 'redux'; import {persistStore} from 'redux-persist'; import reducers from './reducers/index.js'; @@ -68,6 +69,10 @@ function init() { initLauncherHooks(config(), store); const sessionId = store.getState().application.sessionId; initCrashReporter(sessionId || ''); + + requestIdleCallback(() => { + setupPrefetcher(); + }); } // rehydrate app state before exposing init