Test MotaJS now with Tonic! (no installation needed)
About
MotaJS is a JavaScript library that includes a lot of different things to help you build web applications easily from scratch. The idea is to include API's higher than the ones provided by the browser but lower enough so that you can build on top of them if you like. I'm open to other ideas so, if you want to contribute with code or documentation, see the Contribute section below. Thanks.
Features
Utilities
Includes a lot of useful functions: assign, keys, isEqual, isObject, etc...
var object1 = apple: 0 banana: weight: 52 price: 100 cherry: 97; var object2 = banana: price: 200 durian: 100; mota;// { apple: 0, banana: { price: 200 }, cherry: 97, durian: 100 }
Events
A module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events.
var object = {};mota; object; object;
It supports regular expressions!
obj;obj;
Map
The Map object is a simple key/value map. Any value (both objects and primitive values) may be used as either a key or a value.
Implemented by a hash-array mapped trie.
You can create mutable maps...
var map1 = mota;var map2 = map1;map1; // 50map2; // 50map1 === map2 // true
... but you can also create immutable ones.
var map1 = mota;var map2 = map1;map1 === map2 // no change var map3 = map1;map1 !== map3 // change map1; // 2map3; // 50
If you use it as mutable data, you can observe changes:
var map1 = mota; map1;
Pathname
Allows you to resolve and normalize pathnames.
Observable
An implementation of the Observable proposal + some other features.
Promise
A complete Promise polyfill.
It also emits unhandledRejection
/rejectionHandled
events on NodeJS and unhandledrejection
/rejectionhandled
events on the Browser.
Router
Simple express-style router. Works in NodeJS and the browser.
var router = ; router; router;
History
Helps you use the History API in the browser.
var router = ; router; var history = router ; history;
View
- Use 100% JavaScript to build your templates.
- Implements one-way data flow.
- Uses a diff implementation for high performance.
- Supports rendering into a string.
- Supports fragments.
...var TodoApp = motaview; motaview;
Complete example here.
Downloads
List of all releases and changelog
Installation
Browser
MotaJS is also available through jsDelivr CDN and cdnjs.
Node.js
npm install motajs
Documentation
All the information about how to use MotaJS is available here.
If you want to see documentation of the latest or previous versions, just select a different tag instead of master
.
Browser support
- Internet Explorer - 11
- Chrome & Firefox & Safari & Opera & Edge - Current version
- iOS - 6.1+
- Android - 4.0+
Contribute
The project is hosted on GitHub. You can report bugs and discuss features on the issues page.
How to build and test your copy of MotaJS