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

📄 2.04 - the interface implementation for this book.js

📁 JS设计模式源代码
💻 JS
字号:
// Interfaces.var Composite = new Interface('Composite', ['add', 'remove', 'getChild']);var FormItem = new Interface('FormItem', ['save']);// CompositeForm classvar CompositeForm = function(id, method, action) { // implements Composite, FormItem   ...};...function addForm(formInstance) {    Interface.ensureImplements(formInstance, Composite, FormItem);    // This function will throw an error if a required method is not implemented,    // halting execution of the function.    // All code beneath this line will be executed only if the checks pass.    ...}	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -