📄 16.03 - using interfaces with the command pattern.js
字号:
/* Command interface. */var Command = new Interface('Command', ['execute']);/* Checking the interface of a command object. */// Ensure that the execute operation is defined. If not, a descriptive exception// will be thrown.Interface.ensureImplements(someCommand, Command);// If no exception is thrown, you can safely invoke the execute operation. someCommand.execute(); /* Checking command functions. */if(typeof someCommand != 'function') { throw new Error('Command isn't a function');}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -