58 lines
2.1 KiB
JavaScript
58 lines
2.1 KiB
JavaScript
import { Cache } from './cache';
|
|
import { Location } from './location';
|
|
import { RunningTree } from './runningTree';
|
|
import { Locales } from './locales';
|
|
import { LocalStorage } from './localStorage';
|
|
import { Notification } from './notification';
|
|
import { Environment } from './environment';
|
|
import { Message } from './message';
|
|
import { Navigator } from './navigator';
|
|
import { Port } from './port';
|
|
// import { RelationAuth } from './relationAuth';
|
|
import { Style } from './style';
|
|
import { SubScriber } from './socket/subscriber';
|
|
import SocketPoint from './socket/socketPoint';
|
|
import { Socket } from './socket/socket';
|
|
import { ContextMenuFactory } from './contextMenuFactory';
|
|
import { Geo } from './geo';
|
|
export function initializeStep2(features, connector, storageSchema, frontendContextBuilder, checkers, common, render) {
|
|
const { localStorage, environment, message } = features;
|
|
const cache = new Cache(storageSchema, connector, frontendContextBuilder, checkers, localStorage, common);
|
|
const runningTree = new RunningTree(cache, storageSchema);
|
|
const geo = new Geo(cache);
|
|
const port = new Port(cache);
|
|
const style = new Style(render.styleDict);
|
|
const locales = new Locales(cache, localStorage, environment, 'zh-CN'); // 临时性代码,应由上层传入
|
|
const contextMenuFactory = new ContextMenuFactory(cache);
|
|
const socketPoint = new SocketPoint(() => connector.getSocketPoint());
|
|
const subscriber = new SubScriber(cache, message, socketPoint);
|
|
const socket = new Socket(message, socketPoint);
|
|
return {
|
|
cache,
|
|
socket,
|
|
runningTree,
|
|
locales,
|
|
port,
|
|
style,
|
|
geo,
|
|
contextMenuFactory,
|
|
subscriber,
|
|
};
|
|
}
|
|
export function initializeStep1() {
|
|
const location = new Location();
|
|
const environment = new Environment();
|
|
const localStorage = new LocalStorage();
|
|
const notification = new Notification();
|
|
const message = new Message();
|
|
const navigator = new Navigator();
|
|
return {
|
|
location,
|
|
environment,
|
|
notification,
|
|
message,
|
|
localStorage,
|
|
navigator,
|
|
};
|
|
}
|