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

Subsets

Rich Harris edited this page Apr 21, 2013 · 1 revision

WikiSubsets

Documentation coming soon! In the meantime, a quick demo:

state = new Statesman({
  foo: {
    bar: {
      baz: 'boo'
    }
  }
});

bar = state.subset( 'foo.bar' );

bar.get( 'baz' ); // boo

bar.set( 'baz', 'ben' );
state.get( 'foo.bar.baz' ); // 'ben'

bar.observe( 'baz', alert );
bar.set( 'baz', 'bee' ); // alerts 'bee'
state.set( 'foo.bar.baz', 'bam' ); // alerts 'bam'

Next: API reference

Clone this wiki locally