Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.
/ boo Public archive

[Unmaintained: please use refinable instead] Prototypical utilities for Object Orientation / Composition

License

Notifications You must be signed in to change notification settings

sorellabs/boo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boo

Build Status NPM version Dependencies Status stable

browser support

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.

Example

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~')

Installing

The easiest way is to grab it from NPM. If you're running in a Browser environment, you can use Browserify:

$ npm install boo

Using with CommonJS

If you're not using NPM, Download the latest release, and require the boo.umd.js file:

var boo = require('boo')

Using with AMD

Download the latest release, and require the boo.umd.js file:

require(['boo'], function(boo) {
  ( ... )
})

Using without modules

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>

Compiling from source

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.

Testing

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.

Benchmarks

There are a few benchmarks you can run:

$ make benchmark

Learning

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:

Reference

extend(target, mixins...)

Extends the target with the provided mixins, using a right-most precedence rule.

extend: object, mixin... -> object

merge(mixins...)

Like extend, but pure.

merge: mixin... -> object

derive(proto, mixin...)

Constructs a new object that inherits from proto.

derive: object, mixin... -> object

Base:make(...)

Instantiates a new object, and initialises it by calling the init method.

make: @object => A... -> this <| object

Base:derive(mixin...)

Like derive, but the prototype is the this object.

derive: @object => mixin... -> this <| object

Getting support

Boo uses the Github tracker for tracking bugs and new features.

Licence

Copyright (c) 2011-2014 Quildreen Motta.

Released under the MIT licence.

About

[Unmaintained: please use refinable instead] Prototypical utilities for Object Orientation / Composition

Resources

License

Stars

Watchers

Forks

Packages

No packages published