⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 16.03 - using interfaces with the command pattern.js

📁 JS设计模式源代码
💻 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 + -