me.plugin

There is no constructor function for me.plugin

Classes

Base

Methods

static patch(proto, name, fn)

patch a melonJS function

Parameters:
Name Type Description
proto Object

target object

name String

target function

fn function

replacement function

Example
// 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();
});

static register(plugin, name)

Register a plugin.

Parameters:
Name Type Attributes Description
plugin me.plugin.Base

Plugin to instiantiate and register

name String
arguments... <optional>

all extra parameters will be passed to the plugin constructor

See:
Example
// register a new plugin
me.plugin.register(TestPlugin, "testPlugin");
// the plugin then also become available
// under then me.plugins namespace
me.plugins.testPlugin.myfunction ();