API Docs for: 0.1.0
Show:

mclib.Event Class

Simple generic events class. Create an event using this class.

Constructor

mclib.Event

()

Item Index

Methods

addHandler

(
  • handler
)

Add event handler to listen for an event.

Parameters:

  • handler Function

    A function that will be called when event is triggered.

Example:

var loading = new mclib.Event(),
    handler = function (params) {
                alert("I've been handled");
              };

loading.addHandler(handler);

removeHandler

(
  • handler
)

Remove existing event handler.

Parameters:

  • handler Function

    A function that will be called when event is triggered.

Example:

var loading = new mclib.Event(),
    handler = function (params) {
                alert("I've been handled");
              };

loading.removeHandler(handler);

trigger

(
  • argsObj
)

Run all listening event handlers.

Parameters:

  • argsObj Object

    An object that contains the parameters that will be passed to the handlers.

Example:

var loading = new mclib.Event(),
    handler = function (params) {
                alert("I've been handled " + params.value );
              };

loading.addHandler(handler);
loading.trigger({value: "whilst loading"});