1
//
TODO define Interface
2
var Composite =
new Interface('Composite',['add','remove','getChild']);
3
var FormItem =
new Interface('FormItem',['save']);
4
5
//
TODO checkout implements
6
function addForm(formInstace,isDevelop){
7 isDevelop && Interface.ensureImplements(formInstace, Composite, FormItem)
8
//
其餘使用add,remove,getchild,save函數的代碼段
9
}
10
//
CompositeForm class
11
var CompositeForm =
function(id, method, action){};
12 CompositeForm.prototype = {
13 add:
function(){},
14 remove:
function(){},
15 getChild:
function(){}
16 ,save:
function(){}
17 };
18
19
var testCompositeForm =
new CompositeForm()
20 addForm(testCompositeForm,
true)