milo

milo

function
 milo() 

milo

A minimalist browser framework that binds DOM elements to JS components and components to models.

milo is available as global object in the browser.
At the moment it is not possiible to require it with browserify to have it bundled with the app because of the way brfs browserify plugin is implemented.
It is possible though to require milo with node to use universal parts of the framework (abstract classes, Messenger, Model, etc.):

var milo = require('milojs');

milo itself is a function that in the browser can be used to delay execution until DOM is ready.

function milo(func) {
    milo.util.domReady(func);
}

####Milo packages####

  • loader - loading subviews into page
  • binder - components instantiation and binding of DOM elements to them
  • minder - data reactivity, one or two way, shallow or deep, as you like it
  • mail - applicaiton level messenger, also connects to messages from other windows dispatched with window.postMessage.
  • config - milo configuration
  • util - logger, request, dom, check, error, etc.
  • classes - abstract and base classes
  • attributes - classes that wrap DOM elements attributes recognized by milo
  • ComponentFacet - base class of Component facet
  • Component - base Component class
  • Messenger - generic Messenger used in most other milo classes, can be mixed into app classes too.
  • Model - Model class that emits messages on changes to any depth without timer based watching
  • registry - registries of fasets and components classes
_.extend(milo, {
    Messenger: miloCore.Messenger,
    Model: miloCore.Model,
    minder: miloCore.minder,
    loader: require('./loader'),
    binder: require('./binder'),
    mail: require('./services/mail'),
    window: require('./services/window'),
    config: require('./config'),
    util: require('./util'),
    classes: require('./classes'),
    attributes: require('./attributes'),
    ComponentFacet: require('./components/c_facet'),
    Component: require('./components/c_class'),
    Command: require('./command'),
    registry: require('./registry'),
    milo_version: '0.2.6',
    createComponentClass: require('./util/create_component_class'),
    createFacetClass: require('./util/create_facet_class'),
    destroy: destroy
});


// export for node/browserify
if (typeof module == 'object' && module.exports)    
    module.exports = milo;

// global milo for browser
if (typeof window == 'object') {
    window.milo = milo;
    milo.mail.trigger('miloready');
}


function destroy() {
    miloCore.destroy();
    milo.mail.destroy();
    milo.window.destroy();
    milo.util.destroy();
}