API Docs for: 0.1.0
Show:

mclib.pouch Class

Class or Namespace that handles pouches. Pouches are small destroyable objects that can easily be passed between method calls and then destroyed once used.

Item Index

Methods

Properties

Events

Methods

destroy

(
  • verbs
)

Destroy a pouch.

Parameters:

  • verbs Object

    An object containing verb to perform and a comma seperated list of members to perform them on.

Example:

var pouch = mclib.pouch.get();
pouch.additional = "I've been added to the pouch";
pouch.window1 = window.open("http://techn0place.blogspot.com");
pouch.window2 = window.open("http://techn0place.blogspot.com");

anotherFunction(pouch);  //passed to another function

pouch.destroy({close: "window1,window2"});

get

(
  • prefix
)

Get a pouch.

Parameters:

  • prefix String

    An optional prefix for the pouch. Used for id.

Example:

var pouch = mclib.pouch.get();
pouch.additional = "I've been added to the pouch";

anotherFunction(pouch);  //passed to another function

Properties

destroying

Boolean

Indicates if the pouch is in the process of being destroyed.

fullName

String

Full Name of pouch. Useful if accessing via HTML.

Example:

 var html = "<a href='http://techn0place.blogspot.com' onclick='" + pouch.fullName + ".linked = true;'">Blog</a>";

id

String

Unique id of pouch.

Events

beforeDestroy

Event that is triggered before pouch is actually destroyed.

Example:

 var pouch = mclib.pouch.get(),
     handler = function (params) {
             //passed "store" and "verbs" in object
             if (params.pouch.value === 1) {
                 alert("I haven't changed");
             }
             params.pouch.value = 2;
             // pouch contents or verbs can be changed here.
           };

 pouch.value = 1;

 pouch.beforeDestroy.addHandler(handler);