mojo
v0.10.0
Published
MojoJS is a fast, customizable JavaScript MVC framework that runs on NodeJS, and Web.
Downloads
10
Readme
MojoJS is a fast, customizable JavaScript MVC framework that runs on NodeJS, and Web.
This library comes pre-bundled with: mojo-models, views, mojo-paperclip, mojo-router, mojo-bootstrap, zepto, and inject.js.
See also
- starter kit - seed application. Helps you get started with Mojo and browserify (commonjs).
Projects using Mojo
- TodoMVC - todomvc example
- Reader - reddit reader example
- ClassDojo - server-side & client-side both run Mojo.
Build Commands
make browser # builds the app for the browser
make browser min # builds the app for the browser, and minifies
Basic Example
Below is a basic example of how you can use Mojo in the browser. Note that it's highly recommended that you use commonjs (browserify, NodeJS), or amd (requirejs, injectjs) when organizing your application.
<html>
<head>
<script type="text/javascript" src="mojo.js"></script>
</head>
<body>
<script type="text/x-paperclip" id="hello-template">
Hello! What's your name?
<input type="text" data-bind="{{ model: <~>name }}"></input>
{{#if:name}}
<h1>Hello {{name}}!</h1>
{{/}}
</script>
<script type="text/javascript">
var view = new mojo.views.Base({
paper: $("#hello-template").text()
});
document.body.appendChild(view.render());
</script>
</body>
</html>