Фасад (шаблон проектирования): различия между версиями

[непроверенная версия][непроверенная версия]
Содержимое удалено Содержимое добавлено
м оформление
Строка 37:
function SubSystem1() {
this.method1 = function() {
alertconsole.log("вызван SubSystem1.method1");
};
return this;
}
function SubSystem2() {
this.method2 = function() {
alertconsole.log("вызван SubSystem2.method2");
};
this.methodB = function() {
alertconsole.log("вызван SubSystem2.methodB");
};
return this;
}
 
/* Facade */
function Facade() {
var s1 = new SubSystem1();,
var s2 = new SubSystem2();
this.m1 = function() {
alertconsole.log("вызван Facade.m1");
s1.method1();
s2.method2();
Строка 61 ⟶ 63 :
 
this.m2 = function() {
alertconsole.log("вызван Facade.m2");
s2.methodB();
};
return this;
}
 
/* Client */
function Testtest() {
var facade = new Facade();
facade.m1();
facade.m2();
}
 
test();
var obj = new Test();
/*
Выведет: