var BaseModalMethods = { init : function () { console.log('BaseModalMethods.init'); }, modal : function () { this.beforeShow(); console.log('BaseModalMethods.modal'); } }; function SimpleModalPlugin() { this.beforeShow = function() { console.log('SimpleModalPlugin.beforeShow'); } } SimpleModalPlugin.prototype = BaseModalMethods; var a = new SimpleModalPlugin(); a.modal();
Вывод:
SimpleModalPlugin.beforeShow BaseModalMethods.modal