mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
add noop function, handle undefined
This commit is contained in:
+3
-6
@@ -7,6 +7,7 @@ import {createRestClient} from './rest';
|
||||
import thunk from 'redux-thunk';
|
||||
import {loadTranslations} from './i18n';
|
||||
import bowser from 'bowser';
|
||||
import noop from 'lodash/noop';
|
||||
import {BASE_PATH} from 'coral-framework/constants/url';
|
||||
import {createPluginsService} from './plugins';
|
||||
import {createNotificationService} from './notification';
|
||||
@@ -77,7 +78,7 @@ export async function createContext({
|
||||
graphqlExtension = {},
|
||||
notification,
|
||||
preInit,
|
||||
init,
|
||||
init = noop,
|
||||
} = {}) {
|
||||
const eventEmitter = new EventEmitter({wildcard: true});
|
||||
const storage = createStorage();
|
||||
@@ -178,11 +179,7 @@ export async function createContext({
|
||||
await preInit(context);
|
||||
}
|
||||
|
||||
if (init) {
|
||||
await init(context);
|
||||
}
|
||||
|
||||
// Run initialization.
|
||||
await Promise.all([init, plugins.executeInit(context)]);
|
||||
await Promise.all([init(context), plugins.executeInit(context)]);
|
||||
return context;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user