假设我已经创建了一个函数构造函数,例如
function Bar(){
}
var obj = new Bar();
Run Code Online (Sandbox Code Playgroud)
有没有让Object.prototype.toString.call(obj)回报之类的东西[object Date]?
我怎么能在dojo中调用另一个方法的父方法.考虑以下示例:
var parent = declare(null,{
m1: function(arg){
console.log("parent.m1");
},
m2: function(arg){
console.log("parent.m2");
}
});`enter code here`
var child = declare(parent,{
m1: function(arg){
console.log("child.m1");
// how can i call parent.**m2** here directly without calling child.m2
},
m2: function(arg){
console.log("child.m2");
}
});
Run Code Online (Sandbox Code Playgroud)
如何直接从child.m1调用parent.m2而不调用child.m2
现在假设我定义了两个模块如下:
parentModule.js
var parent = declare(null,{
m1: function(arg){
console.log("parent.m1");
},
m2: function(arg){
console.log("parent.m2");
}
});
return declare("ParentModule",[parent,child]);
//******************************************//
childModule.js
return declare("child",null,{
m1: function(arg){
console.log("child.m1");
// how can i call parent.**m2** here directly without calling child.m2
//if we call ParentModule.prototype.m2.call(this,arguments); …Run Code Online (Sandbox Code Playgroud)