DesignByContract Class
契约式设计。
Item Index
Methods
- mustBeAFunction static
- mustBeDefined static
Methods
mustBeAFunction
(
DesignByContract
static
-
variableName
-
variableValue
指定名称的变量必须是函数类型,否则抛出异常。
Parameters:
-
variableName
String变量名
-
variableValue
Function值
Returns:
Example:
readAll: function (callback) {
var me = this;
dbc.mustBeDefined('callback', callback);
dbc.mustBeAFunction('callback', callback);
return readAll(me.getOptions(), callback);
}
mustBeDefined
(
DesignByContract
static
-
variableName
-
variableValue
指定名称的变量必须已经定义,否则抛出异常。
Parameters:
-
variableName
String变量名
-
variableValue
String值
Returns:
Example:
readAll: function (callback) {
var me = this;
dbc.mustBeDefined('callback', callback);
return readAll(me.getOptions(), callback);
}