dou
Light-weight javascript module framework (Inspired by flight - A component-based, event-driven JavaScript framework from Twitter http://flightjs.github.io/)
'dou' means ..
- 都 (all) - Chinese pinyin
- Do you .. - English
Features
- Advice
- Mixin
- Event
- Property
- Life Cycle
Getting Started
It supports packages for nodejs, bower & rails.
As a gem for rails provides:
- dou-rails
As a package for nodejs provides:
- dou
As a package for bower provides:
- dou
Install the nodejs module with:
npm install dou --save
Install the bower module with:
bower install dou --save
Configure for requirejs as follow:
requirejs;
Install the rails module with Gemfile
And run bundle install
. The rest of the installation depends on
whether the asset pipeline is being used.
Rails 3.1 or greater (with asset pipeline enabled)
The dou-rails files will be added to the asset pipeline and available for you to use. If they're not already in app/assets/javascripts/application.js
by default, add these lines:
//= require dou-min
Usage
Define Class
var dou = ; var Super = dou; var inst = ; inst;
Extend
var Clazz = dou; var inst = ; inst;inst;inst;
Constructor
var Clazz = dou; var inst = arg;
Mixin
{ /* 'this' is prototype of Target Class. in this case Clazz.prototype */ this { return 'foo'; };} { /* 'this' is prototype of Target Class. in this case Clazz.prototype */ this { return 'bar'; };} var Clazz = dou; var inst = ; inst;inst;
Advice
{ this; this; this;} var Clazz = dou; var inst = ; inst;
Event
var Clazz = dou; var inst = ; inst; inst; inst;
Property
var Clazz = dou; var inst = ; inst; inst; inst; var val = inst; // val should be 'value1'
Life Cycle
var Clazz = dou; var inst = ;inst; var val1 = inst; // val1 should be 'A'var val2 = inst; // val2 should be 'b'
License
Copyright (c) 2014 Hearty, Oh. Licensed under the MIT license.