MonkeyPatching: PrimeFaces widgets extend/override
问题 I'm currently using (it's working fine) PrimeFaces.widget.OverlayPanel.prototype._old_init = PrimeFaces.widget.OverlayPanel.prototype.init; PrimeFaces.widget.OverlayPanel.prototype.init = function(cfg) { this._old_init(cfg); this.align(); } but I'd like to use something more readable and 'jQuery-ish' like this completely invented unrealistic code: PrimeFaces.widget.OverlayPanel.patch( { init: function(cfg) { super.init(cfg); this.align(); }, show: function() { console.log('blah blah blah');