Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function configureStorybook() {
injectLokiGlobalErrorHandler();
// Decorate the storiesOf function to be able to skip stories
const getStorybook = decorateStorybook(storybook);
// Monkey patch `Image`
Object.defineProperty(ReactNative, 'Image', {
configurable: true,
enumerable: true,
get: () => require('./ready-state-emitting-image'),
});
const channel = await getAddonsChannel();
const platform = ReactNative.Platform.OS;
const on = (eventName, callback) =>
channel.on(`${MESSAGE_PREFIX}${eventName}`, params => {
if (params && params.platform === platform) {
callback(params);
}
return function configureStorybook() {
if (typeof window === 'object') {
if (!window.loki) {
window.loki = {};
}
window.loki.getStorybook = decorateStorybook(storybook);
window.loki.registerPendingPromise = registerPendingPromise;
window.loki.resetPendingPromises = resetPendingPromises;
window.loki.awaitReady = awaitReady;
}
};
}