2.01 - describing interfaces with comments.js

来自「JS设计模式源代码」· JavaScript 代码 · 共 36 行

JS
36
字号
/*interface Composite {    function add(child);    function remove(child);    function getChild(index);}interface FormItem {    function save();}*/var CompositeForm = function(id, method, action) { // implements Composite, FormItem    ...};// Implement the Composite interface.CompositeForm.prototype.add = function(child) {    ...};CompositeForm.prototype.remove = function(child) {    ...};CompositeForm.prototype.getChild = function(index) {    ...};// Implement the FormItem interface.CompositeForm.prototype.save = function() {    ...};

⌨️ 快捷键说明

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