Define namespaces for implementation of simple components. This project is in its ideal create a simple javascript framework for building applications.
<div data-component="example" data-color="red">
<span data-element="field">My Element</span>
<button type="button" data-action="change-color">Set Color</button>
</div>
MONKEY.ComponentWrapper( 'Example', function(Example) {
Example.fn.init = function() {
this.addEventListener();
};
Example.fn.addEventListener = function() {
this.addEvent( 'click', 'change-color' );
};
Example.fn.setBackground = function() {
this.elements.field.css( 'background', this.color );
};
Example.fn._onClickChangeColor = function() {
this.setBackground();
};
});
//start components in application
MONKEY.factory.create( $( 'body' ) );
You also check the wiki.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Nando Vieira in project module