Skip to content

icelab/exposure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple method for exposing namespaced objects. It’s mostly a formalisation of the module creation pattern.

Usage

Simply call the Exposure() function and assign it to a variable and you’re all set.

var APP = Exposure();
APP.expose("foo.bar");
APP.foo.bar = true;

Exposure doesn’t pollute the global scope unless you want it to, so you can set up namespaces wherever you’d like:

APP.foo.bar.baz = "baz";
APP.expose("foo.bar").biz = function() {
    var Inception = Exposure();
    Inception.expose("reality.yusuf.arthur.eames").limbo = true;
};
// You *can* choose to make it global
window.APP = APP;

Note: This means you can clobber your global objects by accident, so you do need to be careful.

License

Exposure is releaed under the MIT License.

About

A simple method for exposing namespaced objects.

Resources

License

Stars

Watchers

Forks

Packages