Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

boekkooi/reactive-extra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Reactive Extra package

This is a Meteor package containing reactive classes. These classes can be used within Meteor to easily create reactive objects, dictionaries and arrays.

Install

Meteorite

Using meteorite do the following:

mrt add reactive-extra

Other

If you don't like using meteorite create the folder packages/reactive-extra/ and can copy the packages.js and lib/ to it.

ReactiveObject

A reactive object implementation. Checkout the api docs

Usage

var obj = new ReactiveObject({'foo':'1'});
obj.defineProperty('bar', 2);

obj.foo = '2';
obj.undefineProperty('foo'); // Don't use 'delete obj.foo' it will give strange results

ReactiveDictionary

A reactive dictionary implementation. Checkout the api docs

Usage

var obj = new ReactiveDictionary({'foo':'1'});
obj.add('bar', 2);
obj.count()
obj.foo = '2'
obj.remove('foo'); // Don't use 'delete obj.foo' it will give strange results
obj.clear();

ReactiveArray

A reactive array implementation. Checkout the api docs.

Usage

var arr = new ReactiveArray(1,2,3,4);
console.log arr.length
arr.map(function(v) {
    return v+1
}).toArray();

// Be aware that using 'arr[9] = "a"' won't work correctly
// A work around is to use 'arr.length = 10' and then do 'arr[9] = "a"'

ReactiveList

A reactive list implementation based on ReactiveArray. This implementation has a custom handlebars each helper extension. Checkout the api docs.

Cake

The current cake commands require the wrench module, on windows the which module is also required.

cake build

This command will compile the files in src/ to lib/.

cake example

This command will compile the files in src/ to lib/, after which it will copy packages.js and lib/ to example/packages/reactive-extra.

cake docs

This command will generate the api docs in docs/. To get it working make sure you have docco installed.

Todo

  • Write a real example not just a placeholder for tests
  • Create Harmony Proxy versions of the classes
  • Add observe and/or observeChanges methods when possible
  • Add more test where necessary