var app = new Handler({
handle: function () {
console.log('app handle');
}
}, 3);
var dialog = new Handler(app, 1);
var button = new Handler(dialog, 2);
button.handle();
var app = new Handler({
handle: function () {
console.log('app handle');
}
}, 3);
var dialog = new Handler(app, 1);
dialog.handle = function () {
console.log('dialog before ...')
// 這里做具體的處理操作
console.log('dialog after ...')
};
var button = new Handler(dialog, 2);
button.handle();
var app = new Handler({
handle: function () {
console.log('app handle');
}
}, 3);
var dialog = new Handler(app, 1);
dialog.handle = function () {
console.log('dialog before ...')
// 這里做具體的處理操作
Handler.prototype.handle.call(this); //繼續(xù)往上走
console.log('dialog after ...')
};
var button = new Handler(dialog, 2);
button.handle = function () {
console.log('button before ...')
// 這里做具體的處理操作
Handler.prototype.handle.call(this);
console.log('button after ...')
};
button.handle();
更多建議: