plugin.patch

patch(proto: object, name: string, fn: Function) → {}

patch a melonJS function

// 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();
});
Parameters:
Name Type Description
proto object

target object

name string

target function

fn Function

replacement function

Returns:
Type Description
Powered by webdoc!