diff --git a/src/Application.js b/src/Application.js index 1d6a4f92..8f1139f8 100644 --- a/src/Application.js +++ b/src/Application.js @@ -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); diff --git a/src/Editor.js b/src/Editor.js index 974510d2..9a7e670a 100644 --- a/src/Editor.js +++ b/src/Editor.js @@ -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'; diff --git a/src/Options.js b/src/Options.js new file mode 100644 index 00000000..0bb3d90e --- /dev/null +++ b/src/Options.js @@ -0,0 +1,10 @@ +/** + * 配置选项 + * @param {*} options 配置选项 + */ +function Options(options) { + options = options || {}; + this.server = options.server || 'http://127.0.0.1:1500'; +} + +export default Options; \ No newline at end of file diff --git a/src/Config.js b/src/core/Config.js similarity index 100% rename from src/Config.js rename to src/core/Config.js diff --git a/src/core/index.js b/src/core/index.js index dfbb3c17..517facab 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -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'; diff --git a/src/index.js b/src/index.js index 75f3c894..b68eeb65 100644 --- a/src/index.js +++ b/src/index.js @@ -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'; \ No newline at end of file