40e49f1a225e2d0cb028a247d55bf87a.json
17.9 KB
{"ast":null,"code":"/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Invoker - invoke commands\r\n */\nimport snippet from 'tui-code-snippet';\nimport { Promise } from './util';\nimport commandFactory from './factory/command';\nimport { eventNames, rejectMessages } from './consts';\nconst {\n isFunction,\n isString,\n CustomEvents\n} = snippet;\n/**\r\n * Invoker\r\n * @class\r\n * @ignore\r\n */\n\nclass Invoker {\n constructor() {\n /**\r\n * Undo stack\r\n * @type {Array.<Command>}\r\n * @private\r\n */\n this._undoStack = [];\n /**\r\n * Redo stack\r\n * @type {Array.<Command>}\r\n * @private\r\n */\n\n this._redoStack = [];\n /**\r\n * Lock-flag for executing command\r\n * @type {boolean}\r\n * @private\r\n */\n\n this._isLocked = false;\n this._isSilent = false;\n }\n /**\r\n * Invoke command execution\r\n * @param {Command} command - Command\r\n * @returns {Promise}\r\n * @private\r\n */\n\n\n _invokeExecution(command) {\n this.lock();\n let {\n args\n } = command;\n\n if (!args) {\n args = [];\n }\n\n return command.execute(...args).then(value => {\n if (!this._isSilent) {\n this.pushUndoStack(command);\n }\n\n this.unlock();\n\n if (isFunction(command.executeCallback)) {\n command.executeCallback(value);\n }\n\n return value;\n })['catch'](message => {\n this.unlock();\n return Promise.reject(message);\n });\n }\n /**\r\n * Invoke command undo\r\n * @param {Command} command - Command\r\n * @returns {Promise}\r\n * @private\r\n */\n\n\n _invokeUndo(command) {\n this.lock();\n let {\n args\n } = command;\n\n if (!args) {\n args = [];\n }\n\n return command.undo(...args).then(value => {\n this.pushRedoStack(command);\n this.unlock();\n\n if (isFunction(command.undoCallback)) {\n command.undoCallback(value);\n }\n\n return value;\n })['catch'](message => {\n this.unlock();\n return Promise.reject(message);\n });\n }\n /**\r\n * fire REDO_STACK_CHANGED event\r\n * @private\r\n */\n\n\n _fireRedoStackChanged() {\n this.fire(eventNames.REDO_STACK_CHANGED, this._redoStack.length);\n }\n /**\r\n * fire UNDO_STACK_CHANGED event\r\n * @private\r\n */\n\n\n _fireUndoStackChanged() {\n this.fire(eventNames.UNDO_STACK_CHANGED, this._undoStack.length);\n }\n /**\r\n * Lock this invoker\r\n */\n\n\n lock() {\n this._isLocked = true;\n }\n /**\r\n * Unlock this invoker\r\n */\n\n\n unlock() {\n this._isLocked = false;\n }\n\n executeSilent(...args) {\n this._isSilent = true;\n return this.execute(...args, this._isSilent).then(() => {\n this._isSilent = false;\n });\n }\n /**\r\n * Invoke command\r\n * Store the command to the undoStack\r\n * Clear the redoStack\r\n * @param {String} commandName - Command name\r\n * @param {...*} args - Arguments for creating command\r\n * @returns {Promise}\r\n */\n\n\n execute(...args) {\n if (this._isLocked) {\n return Promise.reject(rejectMessages.isLock);\n }\n\n let [command] = args;\n\n if (isString(command)) {\n command = commandFactory.create(...args);\n }\n\n return this._invokeExecution(command).then(value => {\n this.clearRedoStack();\n return value;\n });\n }\n /**\r\n * Undo command\r\n * @returns {Promise}\r\n */\n\n\n undo() {\n let command = this._undoStack.pop();\n\n let promise;\n let message = '';\n\n if (command && this._isLocked) {\n this.pushUndoStack(command, true);\n command = null;\n }\n\n if (command) {\n if (this.isEmptyUndoStack()) {\n this._fireUndoStackChanged();\n }\n\n promise = this._invokeUndo(command);\n } else {\n message = rejectMessages.undo;\n\n if (this._isLocked) {\n message = `${message} Because ${rejectMessages.isLock}`;\n }\n\n promise = Promise.reject(message);\n }\n\n return promise;\n }\n /**\r\n * Redo command\r\n * @returns {Promise}\r\n */\n\n\n redo() {\n let command = this._redoStack.pop();\n\n let promise;\n let message = '';\n\n if (command && this._isLocked) {\n this.pushRedoStack(command, true);\n command = null;\n }\n\n if (command) {\n if (this.isEmptyRedoStack()) {\n this._fireRedoStackChanged();\n }\n\n promise = this._invokeExecution(command);\n } else {\n message = rejectMessages.redo;\n\n if (this._isLocked) {\n message = `${message} Because ${rejectMessages.isLock}`;\n }\n\n promise = Promise.reject(message);\n }\n\n return promise;\n }\n /**\r\n * Push undo stack\r\n * @param {Command} command - command\r\n * @param {boolean} [isSilent] - Fire event or not\r\n */\n\n\n pushUndoStack(command, isSilent) {\n this._undoStack.push(command);\n\n if (!isSilent) {\n this._fireUndoStackChanged();\n }\n }\n /**\r\n * Push redo stack\r\n * @param {Command} command - command\r\n * @param {boolean} [isSilent] - Fire event or not\r\n */\n\n\n pushRedoStack(command, isSilent) {\n this._redoStack.push(command);\n\n if (!isSilent) {\n this._fireRedoStackChanged();\n }\n }\n /**\r\n * Return whether the redoStack is empty\r\n * @returns {boolean}\r\n */\n\n\n isEmptyRedoStack() {\n return this._redoStack.length === 0;\n }\n /**\r\n * Return whether the undoStack is empty\r\n * @returns {boolean}\r\n */\n\n\n isEmptyUndoStack() {\n return this._undoStack.length === 0;\n }\n /**\r\n * Clear undoStack\r\n */\n\n\n clearUndoStack() {\n if (!this.isEmptyUndoStack()) {\n this._undoStack = [];\n\n this._fireUndoStackChanged();\n }\n }\n /**\r\n * Clear redoStack\r\n */\n\n\n clearRedoStack() {\n if (!this.isEmptyRedoStack()) {\n this._redoStack = [];\n\n this._fireRedoStackChanged();\n }\n }\n\n}\n\nCustomEvents.mixin(Invoker);\nexport default Invoker;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/src/js/invoker.js"],"names":["snippet","Promise","commandFactory","eventNames","rejectMessages","isFunction","isString","CustomEvents","Invoker","constructor","_undoStack","_redoStack","_isLocked","_isSilent","_invokeExecution","command","lock","args","execute","then","value","pushUndoStack","unlock","executeCallback","message","reject","_invokeUndo","undo","pushRedoStack","undoCallback","_fireRedoStackChanged","fire","REDO_STACK_CHANGED","length","_fireUndoStackChanged","UNDO_STACK_CHANGED","executeSilent","isLock","create","clearRedoStack","pop","promise","isEmptyUndoStack","redo","isEmptyRedoStack","isSilent","push","clearUndoStack","mixin"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAOA,OAAP,MAAoB,kBAApB;AACA,SAASC,OAAT,QAAwB,QAAxB;AACA,OAAOC,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MAAhB,KAA2B,CAAlC;AACD;AAED;AACF;AACA;;;AACEc,EAAAA,cAAc,GAAG;AACf,QAAI,CAAC,KAAKL,gBAAL,EAAL,EAA8B;AAC5B,WAAKhC,UAAL,GAAkB,EAAlB;;AACA,WAAKwB,qBAAL;AACD;AACF;AAED;AACF;AACA;;;AACEK,EAAAA,cAAc,GAAG;AACf,QAAI,CAAC,KAAKK,gBAAL,EAAL,EAA8B;AAC5B,WAAKjC,UAAL,GAAkB,EAAlB;;AACA,WAAKmB,qBAAL;AACD;AACF;;AA/QW;;AAkRdvB,YAAY,CAACyC,KAAb,CAAmBxC,OAAnB;AAEA,eAAeA,OAAf","sourcesContent":["/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Invoker - invoke commands\r\n */\r\nimport snippet from 'tui-code-snippet';\r\nimport { Promise } from './util';\r\nimport commandFactory from './factory/command';\r\nimport { eventNames, rejectMessages } from './consts';\r\n\r\nconst { isFunction, isString, CustomEvents } = snippet;\r\n\r\n/**\r\n * Invoker\r\n * @class\r\n * @ignore\r\n */\r\nclass Invoker {\r\n constructor() {\r\n /**\r\n * Undo stack\r\n * @type {Array.<Command>}\r\n * @private\r\n */\r\n this._undoStack = [];\r\n\r\n /**\r\n * Redo stack\r\n * @type {Array.<Command>}\r\n * @private\r\n */\r\n this._redoStack = [];\r\n\r\n /**\r\n * Lock-flag for executing command\r\n * @type {boolean}\r\n * @private\r\n */\r\n this._isLocked = false;\r\n\r\n this._isSilent = false;\r\n }\r\n\r\n /**\r\n * Invoke command execution\r\n * @param {Command} command - Command\r\n * @returns {Promise}\r\n * @private\r\n */\r\n _invokeExecution(command) {\r\n this.lock();\r\n\r\n let { args } = command;\r\n if (!args) {\r\n args = [];\r\n }\r\n\r\n return command\r\n .execute(...args)\r\n .then((value) => {\r\n if (!this._isSilent) {\r\n this.pushUndoStack(command);\r\n }\r\n this.unlock();\r\n if (isFunction(command.executeCallback)) {\r\n command.executeCallback(value);\r\n }\r\n\r\n return value;\r\n })\r\n ['catch']((message) => {\r\n this.unlock();\r\n\r\n return Promise.reject(message);\r\n });\r\n }\r\n\r\n /**\r\n * Invoke command undo\r\n * @param {Command} command - Command\r\n * @returns {Promise}\r\n * @private\r\n */\r\n _invokeUndo(command) {\r\n this.lock();\r\n\r\n let { args } = command;\r\n if (!args) {\r\n args = [];\r\n }\r\n\r\n return command\r\n .undo(...args)\r\n .then((value) => {\r\n this.pushRedoStack(command);\r\n this.unlock();\r\n if (isFunction(command.undoCallback)) {\r\n command.undoCallback(value);\r\n }\r\n\r\n return value;\r\n })\r\n ['catch']((message) => {\r\n this.unlock();\r\n\r\n return Promise.reject(message);\r\n });\r\n }\r\n\r\n /**\r\n * fire REDO_STACK_CHANGED event\r\n * @private\r\n */\r\n _fireRedoStackChanged() {\r\n this.fire(eventNames.REDO_STACK_CHANGED, this._redoStack.length);\r\n }\r\n\r\n /**\r\n * fire UNDO_STACK_CHANGED event\r\n * @private\r\n */\r\n _fireUndoStackChanged() {\r\n this.fire(eventNames.UNDO_STACK_CHANGED, this._undoStack.length);\r\n }\r\n\r\n /**\r\n * Lock this invoker\r\n */\r\n lock() {\r\n this._isLocked = true;\r\n }\r\n\r\n /**\r\n * Unlock this invoker\r\n */\r\n unlock() {\r\n this._isLocked = false;\r\n }\r\n\r\n executeSilent(...args) {\r\n this._isSilent = true;\r\n\r\n return this.execute(...args, this._isSilent).then(() => {\r\n this._isSilent = false;\r\n });\r\n }\r\n\r\n /**\r\n * Invoke command\r\n * Store the command to the undoStack\r\n * Clear the redoStack\r\n * @param {String} commandName - Command name\r\n * @param {...*} args - Arguments for creating command\r\n * @returns {Promise}\r\n */\r\n execute(...args) {\r\n if (this._isLocked) {\r\n return Promise.reject(rejectMessages.isLock);\r\n }\r\n\r\n let [command] = args;\r\n if (isString(command)) {\r\n command = commandFactory.create(...args);\r\n }\r\n\r\n return this._invokeExecution(command).then((value) => {\r\n this.clearRedoStack();\r\n\r\n return value;\r\n });\r\n }\r\n\r\n /**\r\n * Undo command\r\n * @returns {Promise}\r\n */\r\n undo() {\r\n let command = this._undoStack.pop();\r\n let promise;\r\n let message = '';\r\n\r\n if (command && this._isLocked) {\r\n this.pushUndoStack(command, true);\r\n command = null;\r\n }\r\n if (command) {\r\n if (this.isEmptyUndoStack()) {\r\n this._fireUndoStackChanged();\r\n }\r\n promise = this._invokeUndo(command);\r\n } else {\r\n message = rejectMessages.undo;\r\n if (this._isLocked) {\r\n message = `${message} Because ${rejectMessages.isLock}`;\r\n }\r\n promise = Promise.reject(message);\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * Redo command\r\n * @returns {Promise}\r\n */\r\n redo() {\r\n let command = this._redoStack.pop();\r\n let promise;\r\n let message = '';\r\n\r\n if (command && this._isLocked) {\r\n this.pushRedoStack(command, true);\r\n command = null;\r\n }\r\n if (command) {\r\n if (this.isEmptyRedoStack()) {\r\n this._fireRedoStackChanged();\r\n }\r\n promise = this._invokeExecution(command);\r\n } else {\r\n message = rejectMessages.redo;\r\n if (this._isLocked) {\r\n message = `${message} Because ${rejectMessages.isLock}`;\r\n }\r\n promise = Promise.reject(message);\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n /**\r\n * Push undo stack\r\n * @param {Command} command - command\r\n * @param {boolean} [isSilent] - Fire event or not\r\n */\r\n pushUndoStack(command, isSilent) {\r\n this._undoStack.push(command);\r\n if (!isSilent) {\r\n this._fireUndoStackChanged();\r\n }\r\n }\r\n\r\n /**\r\n * Push redo stack\r\n * @param {Command} command - command\r\n * @param {boolean} [isSilent] - Fire event or not\r\n */\r\n pushRedoStack(command, isSilent) {\r\n this._redoStack.push(command);\r\n if (!isSilent) {\r\n this._fireRedoStackChanged();\r\n }\r\n }\r\n\r\n /**\r\n * Return whether the redoStack is empty\r\n * @returns {boolean}\r\n */\r\n isEmptyRedoStack() {\r\n return this._redoStack.length === 0;\r\n }\r\n\r\n /**\r\n * Return whether the undoStack is empty\r\n * @returns {boolean}\r\n */\r\n isEmptyUndoStack() {\r\n return this._undoStack.length === 0;\r\n }\r\n\r\n /**\r\n * Clear undoStack\r\n */\r\n clearUndoStack() {\r\n if (!this.isEmptyUndoStack()) {\r\n this._undoStack = [];\r\n this._fireUndoStackChanged();\r\n }\r\n }\r\n\r\n /**\r\n * Clear redoStack\r\n */\r\n clearRedoStack() {\r\n if (!this.isEmptyRedoStack()) {\r\n this._redoStack = [];\r\n this._fireRedoStackChanged();\r\n }\r\n }\r\n}\r\n\r\nCustomEvents.mixin(Invoker);\r\n\r\nexport default Invoker;\r\n"]},"metadata":{},"sourceType":"module"}