Boo provides utilities to structure a program by means of prototypical object orientation and object composition, in an easy way. It provides you with inheritance, composition and mixin facilities, all packaged in a nice API.
var Animal = boo.Base.derive({
name: 'Unknow'
, say:
function say(thing) {
return this.name + ': ' + thing }
})
var Cat = Animal.derive({
withName:
function _withName(name) {
return this.derive({ name: name }) }
})
var nyah = Cat.withName('Nyan Cat')
nyah.say('Nyan nyan nyan~')
The easiest way is to grab it from NPM. If you're running in a Browser environment, you can use Browserify:
$ npm install boo
If you're not using NPM, Download the latest release, and require
the boo.umd.js
file:
var boo = require('boo')
Download the latest release, and require the boo.umd.js
file:
require(['boo'], function(boo) {
( ... )
})
Download the latest release, and load the boo.umd.js
file. The properties are exposed in the global boo
object:
<script src="/path/to/boo.umd.js"></script>
If you want to compile this library from the source, you'll need Git, Make, Node.js, and run the following commands:
$ git clone git://github.com/robotlolita/boo.git
$ cd boo
$ npm install
$ make bundle
This will generate the dist/boo.umd.js
file, which you can load in
any JavaScript environment.
For Node, just:
$ make test
For the browser:
$ npm install -g brofist-browser
$ make browser-test
# Then point your browsers to the URL on yer console.
There are a few benchmarks you can run:
$ make benchmark
Boo ships with a full narrated reference manual, covering the
concepts and designs you need to know to use the library effectively.
You can either read it online, or locally — from the file
docs/build/html/index.html
.
Additionally, you can read the following introduction to Boo:
Extends the target with the provided mixins, using a right-most precedence rule.
extend: object, mixin... -> object
Like extend
, but pure.
merge: mixin... -> object
Constructs a new object that inherits from proto
.
derive: object, mixin... -> object
Instantiates a new object, and initialises it by calling the init
method.
make: @object => A... -> this <| object
Like derive
, but the prototype is the this
object.
derive: @object => mixin... -> this <| object
Boo uses the Github tracker for tracking bugs and new features.
Copyright (c) 2011-2014 Quildreen Motta.
Released under the MIT licence.