UNPKG

@applicaster/zapp-react-dom-app

Version:

Zapp App Component for Applicaster's Quick Brick React Native App

31 lines (26 loc) 815 B
export const appLoaderImpl = ( loadSessionStorageData, loadAnalyticsPlugins, loadDomPlugins, loadLocale, setUpRTL ) => async (dispatch, getState) => { try { const { plugins, pluginConfigurations } = getState(); // Await crucial tasks await loadLocale(); await loadSessionStorageData(); await loadAnalyticsPlugins(plugins, pluginConfigurations); // Remaining loaders const loaders = [loadDomPlugins(plugins), setUpRTL()]; // Await for the remaining tasks and return when they are all complete await Promise.all(loaders); // If everything is successful, resolve the promise return Promise.resolve(); } catch (error) { // If something fails, reject the promise return Promise.reject(error); } };