Function patch

  • patch a melonJS function

    Parameters

    • proto: object

      target object

    • name: string

      target function

    • fn: Function

      replacement function

    Returns void

    patch

    plugin

    // redefine the me.game.update function with a new one
    me.plugin.patch(me.game, "update", function () {
    // display something in the console
    console.log("duh");
    // call the original me.game.update function
    this._patched();
    });