$ npm install cmon
API (0.6)
cmon(id)
Delegate tocmon.require(id)
.cmon(id, value)
Delegate tocmon.provide(id, value)
.cmon(id, value, guard)
Delegate tocmon.require(id)
.cmon(fn)
Callfn
in the root scope and receive(cmon)
.
At runtime in a browser cmon
claims the global require
/provide
if unclaimed. Otherwise access them as methods:
cmon.require(id)
Get a module that was provided viacmon.provide
.cmon.require(deps, fn)
Async (fn applies with deps when available).cmon.provide(id, value)
Provide a module.cmon.provide.on(id, fn)
Attach a handler to run anytime id is provided.cmon.provide.one(id, fn)
Attach a 1-time handler to run the next time id is provided.cmon.provide.off(id, fn)
Remove a handler.cmon.provide.off(id)
Remove all id handlers.cmon.provide.emit(id)
Manually trigger activeid
handlers.cmon.able(id, fn?, timeout?)
Attach a 1-time handler runs whenid
is available—async.
cmon.claim(id, value, target?)
Expose a module to the root or to target.cmon.unclaim(id, value, target?)
Safely unexpose a module that was exposed via claim.
cmon.noConflict()
Unclaimrequire
/provide
cmon.noConflict(true)
Unclaimrequire
/provide
/cmon
cmon.noConflict(callback)
Unclaimrequire
/provide
/cmon
Contribute by making edits in /src
or reporting issues.
$ npm install
$ grunt jshint:src
Fund development with tips to @ryanve =)
License: MIT
Copyright (C) 2013 by Ryan Van Etten