mirror of
https://github.com/motajs/template.git
synced 2026-11-16 08:54:30 +08:00
refactor: 插件系统 & 数据端顶层移植
This commit is contained in:
1 parent
b0229c627f
commit
2f3d3387a0
74 files changed
+1322
-3321
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { ILoadTaskStarter } from '@motajs/loader';
|
||||
import {
|
||||
ClientCore,
|
||||
IClientCore,
|
||||
IClientCoreConfig
|
||||
} from '@user/client-modules';
|
||||
import { CLIENT_CORE_URL, TILESET_RESERVE, TILESET_UNIT } from '../constant';
|
||||
import { createCoreStateConfig } from '../data/entry';
|
||||
|
||||
/**
|
||||
* 创建渲染端配置对象
|
||||
* @param starter 加载启动器
|
||||
*/
|
||||
export function createClientCoreConfig(
|
||||
starter: ILoadTaskStarter
|
||||
): IClientCoreConfig {
|
||||
const config: IClientCoreConfig = {
|
||||
clientURL: CLIENT_CORE_URL,
|
||||
tilesetReserve: TILESET_RESERVE,
|
||||
tilesetUnit: TILESET_UNIT,
|
||||
|
||||
...createCoreStateConfig(starter)
|
||||
};
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建渲染端主对象,返回经过初始化的主对象实例
|
||||
* @param starter 加载启动器
|
||||
*/
|
||||
export async function createClientCore(
|
||||
starter: ILoadTaskStarter
|
||||
): Promise<IClientCore> {
|
||||
const config = createClientCoreConfig(starter);
|
||||
const state = new ClientCore(config);
|
||||
await state.load();
|
||||
return state;
|
||||
}
|
||||
Reference in new issue
Block a user