function Test(){
// ...
}
Test.prototype = {
prop1: undefined,
prop2: undefined,
fasad: function(args){
prop1 = args.prop1;
prop2 = args.prop2;
}
};
Обычно фасад реализуют как метод модуля
Two.prototype = Object.create(One.prototype);
function One(){
this.method = function(){
return 'method';
};
}
function Two(){
// ...
}
Two.prototype = new One();
var two = new Two();
console.log(two.method()); // method
function One(){
this.method = function(){
return 'method';
};
}
function Two(){
// ...
}
var Facade = function(){};
Facade.prototype = One.prototype;
Two.prototype = new Facade();
var two = new Two();
console.log(two.method()); // ERROR!!!