Remove import-sideffect call to init()
Summary: Back out "Back out "[flipper] Export init function"" Original commit changeset: 93b916d472b7 The import side effect seems to cause some issues with shadowing, so let's pull this all the way to the top and call this from HTML as Sonar.init(). Reviewed By: danielbuechele Differential Revision: D9849869 fbshipit-source-id: b62772ecddc59eab00251ebf19816f470d76ba82
This commit is contained in:
committed by
Facebook Github Bot
parent
7dd4a83c9a
commit
175ba7f331
10
src/__mocks__/init.js
Normal file
10
src/__mocks__/init.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* 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 function init() {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
@@ -14,9 +14,8 @@ export {SonarBasePlugin, SonarPlugin, SonarDevicePlugin} from './plugin.js';
|
|||||||
export {createTablePlugin} from './createTablePlugin.js';
|
export {createTablePlugin} from './createTablePlugin.js';
|
||||||
export {default as SonarSidebar} from './chrome/SonarSidebar.js';
|
export {default as SonarSidebar} from './chrome/SonarSidebar.js';
|
||||||
|
|
||||||
export * from './init.js';
|
|
||||||
export {default} from './init.js';
|
|
||||||
|
|
||||||
export {default as AndroidDevice} from './devices/AndroidDevice.js';
|
export {default as AndroidDevice} from './devices/AndroidDevice.js';
|
||||||
export {default as Device} from './devices/BaseDevice.js';
|
export {default as Device} from './devices/BaseDevice.js';
|
||||||
export {default as IOSDevice} from './devices/IOSDevice.js';
|
export {default as IOSDevice} from './devices/IOSDevice.js';
|
||||||
|
|
||||||
|
export {default as init} from './init.js';
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ const AppFrame = () => (
|
|||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export default function init() {
|
||||||
// $FlowFixMe: this element exists!
|
// $FlowFixMe: this element exists!
|
||||||
ReactDOM.render(<AppFrame />, document.getElementById('root'));
|
ReactDOM.render(<AppFrame />, document.getElementById('root'));
|
||||||
// $FlowFixMe: service workers exist!
|
// $FlowFixMe: service workers exist!
|
||||||
@@ -75,3 +76,4 @@ navigator.serviceWorker
|
|||||||
(r.installing || r.active).postMessage({precachedIcons});
|
(r.installing || r.active).postMessage({precachedIcons});
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
}
|
||||||
|
|||||||
@@ -85,6 +85,10 @@
|
|||||||
openError('Script failure. Check Chrome console for more info.');
|
openError('Script failure. Check Chrome console for more info.');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script.onload = () => {
|
||||||
|
global.Sonar.init();
|
||||||
|
};
|
||||||
|
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,5 +14,8 @@
|
|||||||
global.electronRequire = window.require;
|
global.electronRequire = window.require;
|
||||||
</script>
|
</script>
|
||||||
<script src="bundle.js"></script>
|
<script src="bundle.js"></script>
|
||||||
|
<script>
|
||||||
|
global.Sonar.init();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user