mirror of
https://github.com/flarum/framework.git
synced 2025-05-24 15:49:58 +08:00
Allow extension of functions that may not be defined
This commit is contained in:
@ -22,7 +22,7 @@ export function extend(object, method, callback) {
|
|||||||
const original = object[method];
|
const original = object[method];
|
||||||
|
|
||||||
object[method] = function(...args) {
|
object[method] = function(...args) {
|
||||||
const value = original.apply(this, args);
|
const value = original ? original.apply(this, args) : undefined;
|
||||||
|
|
||||||
callback.apply(this, [value].concat(args));
|
callback.apply(this, [value].concat(args));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user