tastypie
Version:
Tastypie is a webservice API framework for Node.js based on Django's Tastypie Framework. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces
109 lines (76 loc) • 2.8 kB
Markdown
[](https://npmjs.org/package/prime)
[](https://npmjs.org/package/prime)
[](https://coveralls.io/r/kamicane/prime)
[](http://travis-ci.org/kamicane/prime)
[](https://david-dm.org/kamicane/prime)
[](https://david-dm.org/kamicane/prime#info=devDependencies)
1. fundamental, basic, essential.
2. make (something) ready for use or action.
3. archetypal, prototypical, typical, classic.
prime is an Object Oriented JavaScript library. It helps you with prototypal inheritance and contains generic utilities for every-day JavaScripting.
No Native JavaScript Objects were harmed in the making of this library.
A short overview of the available modules. For more information, refer to the [documentation](https://github.com/mootools/prime/blob/master/doc/prime.md).
The function to create new primes.
```js
var prime = require("prime")
var Animal = prime({
say: function(){
return "!!"
}
})
var Emitter = require("prime/emitter")
var Cat = prime({
inherits: Animal,
mixin: Emitter,
say: function(){
return "meaow" + Cat.parent.say.call(this)
}
})
```
The event emitter.
```js
var Emitter = require("prime/emitter")
var Dog = prime({
inherits: Animal,
mixin: Emitter,
say: function(){
var word = "wuff" + Dog.parent.say.call(this)
this.emit("say", word)
return word
}
})
var barkley = new Dog
barkley.on("say", function(word){
console.log("barkley barked", word)
})
```
Map-like implementation.
```js
var Map = require("prime/map")
var map = new Map()
map.set(domElement, "header")
map.set(domElement2, "footer")
map.get(domElement) // "header"
map.get(domElement2) // "footer"
```
Optimized timeouts / immediates / animationFrames.
```js
var defer = require("prime/defer")
defer.frame(function() {
console.log('on next animation frame');
});
defer.immediate(function() {
console.log('on platform next tick.');
});
defer.timeout(function() {
console.log('late');
}, 500);
```
When all else fails, read the [full documentation](https://github.com/kamicane/prime/blob/master/doc/prime.md).