Getting started
- Create a module by adding the modules attribute to a dom node.
<div modules="hello-world"></div>
- register the module in javascript
mom.createModule('hello-world')
.creator(function(domElement) {
domElement.innerHTML = 'Hello World';
});
- initialize module loading
$(function() {
mom.initModulePage();
});
- declare a part dependency inside your module definition
mom.createModule('hello-world')
.dependencies(['hello-world-part'])
.creator(function(domElement, helloWorldPart) {
domElement.innerHTML = helloWorldPart.sayHello();
});
- register the part in javascript
mom.createPart('hello-world-part')
.creator(function() {
return {
sayHello: sayHello
};
///////////////////////
function sayHello() {
return 'Hello World';
}
});
- checkout additional documentation on parts and modules