template
This commit is contained in:
parent
5ac542309a
commit
49eb0a0a8b
|
|
@ -10,13 +10,18 @@ import { triggers } from './triggers';
|
|||
import { data } from './data';
|
||||
import { routers } from './exceptionRouters';
|
||||
|
||||
const { token } = initializeGeneralFeatures<EntityDict, RuntimeContext, typeof aspectDict>();
|
||||
const { token, extraFile, application } = initializeGeneralFeatures<EntityDict, RuntimeContext, typeof aspectDict>();
|
||||
|
||||
const createFeatures = (basicFeatures: BasicFeatures<EntityDict, RuntimeContext, typeof aspectDict>) => {
|
||||
const features = initialize(basicFeatures);
|
||||
const wholeFeatures = Object.assign({
|
||||
token,
|
||||
}, features);
|
||||
const wholeFeatures = Object.assign(
|
||||
{
|
||||
token,
|
||||
extraFile,
|
||||
application,
|
||||
},
|
||||
features
|
||||
);
|
||||
return wholeFeatures;
|
||||
};
|
||||
|
||||
|
|
@ -29,4 +34,5 @@ export {
|
|||
routers,
|
||||
|
||||
token,
|
||||
application,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,35 @@
|
|||
import './utils/polyfill';
|
||||
import "./utils/polyfill";
|
||||
import { InitializeWechatMp } from 'oak-frontend-base';
|
||||
import { EntityDict } from 'oak-app-domain';
|
||||
import { storageSchema, ActionDefDict } from 'oak-app-domain';
|
||||
import { RuntimeContext } from '../../src/RuntimeContext';
|
||||
import {
|
||||
aspectDict,
|
||||
createFeatures,
|
||||
routers,
|
||||
triggers,
|
||||
checkers,
|
||||
data,
|
||||
token,
|
||||
} from '../../src/initialize';
|
||||
import { aspectDict, createFeatures, routers, triggers, checkers, data, token, application } from '../../src/initialize';
|
||||
|
||||
const { OakComponent, OakPage, features } = InitializeWechatMp<
|
||||
EntityDict,
|
||||
RuntimeContext,
|
||||
typeof aspectDict,
|
||||
ReturnType<typeof createFeatures>
|
||||
>(
|
||||
// 每个应用都要初始化applicationId(generalbusiness的要求)
|
||||
const applicationId = data.application[0].id;
|
||||
const { OakComponent, OakPage, features } = InitializeWechatMp<EntityDict, RuntimeContext, typeof aspectDict, ReturnType<typeof createFeatures>>(
|
||||
storageSchema,
|
||||
createFeatures,
|
||||
(store, scene) =>
|
||||
new RuntimeContext(
|
||||
store,
|
||||
data.application[0].id,
|
||||
() => token.getToken(),
|
||||
scene
|
||||
),
|
||||
(store, scene) => new RuntimeContext(store, applicationId, () => token.getToken(), scene),
|
||||
routers,
|
||||
triggers,
|
||||
checkers,
|
||||
aspectDict,
|
||||
data as any,
|
||||
ActionDefDict
|
||||
);
|
||||
ActionDefDict);
|
||||
|
||||
// 因为依赖的问题,token中的Cache暂时只能在这里注入。以后再修改
|
||||
// 因为依赖的问题,general库中的部分feature暂时只能在这里注入。以后再修改
|
||||
token.setCache(features.cache);
|
||||
application.setCache(features.cache);
|
||||
application.setApplicationId(applicationId);
|
||||
|
||||
|
||||
Object.assign(global, {
|
||||
OakPage,
|
||||
OakComponent,
|
||||
});
|
||||
|
||||
export { features };
|
||||
export {
|
||||
features,
|
||||
createFeatures,
|
||||
};
|
||||
Loading…
Reference in New Issue