1、Config移动到core文件夹。

2、新增Options选项类。
This commit is contained in:
liteng 2018-06-16 13:44:39 +08:00
parent aa5e54ae9c
commit 7069e367df
6 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import Options from './Options';
import Editor from './Editor';
import EventDispatcher from './event/EventDispatcher';
import Viewport from './ui/Viewport';
@ -12,9 +13,10 @@ import RemoveObjectCommand from './command/RemoveObjectCommand';
/**
* 应用程序
*/
function Application(container) {
function Application(container, options) {
this.container = container;
this.options = new Options(options);
// 事件
this.event = new EventDispatcher(this);

View File

@ -1,4 +1,4 @@
import Config from './Config';
import Config from './core/Config';
import Signal from './core/Signal';
import History from './core/History';
import Storage from './core/Storage';

10
src/Options.js Normal file
View File

@ -0,0 +1,10 @@
/**
* 配置选项
* @param {*} options 配置选项
*/
function Options(options) {
options = options || {};
this.server = options.server || 'http://127.0.0.1:1500';
}
export default Options;

View File

@ -1,3 +1,4 @@
export { default as Config } from './Config';
export { default as History } from './History';
export { default as Storage } from './Storage';
export { default as Loader } from './Loader';

View File

@ -7,6 +7,6 @@ export * from './ui/index';
export * from './menu/index';
export * from './panel/index';
export { default as Config } from './Config';
export { default as Options } from './Options';
export { default as Editor } from './Editor';
export { default as Application } from './Application';