@seedalpha/singularity

1.6.11 • Public • Published

Singularity

Storage mechanisms for reactive frontends (inspired by Facebook Flux stores)

Changelog

1.6.1:

  • bugfix in store.remove method

1.5.0:

  • replace array within sync method to prevent vue view-component refresh

1.4.0:

  • disable sorting (use vuejs orderBy in the front)

1.3.1:

  • fix time sorting bug

1.3.0:

  • assume data always sort with time

1.2.0:

  • let fetch accept a callback to notify listeners when data is loaded

1.1.1:

  • fix typo in #query

1.1.0:

  • Remove models from store
  • Sync views on creation

1.0.0:

  • Initial release

Installation

$ npm install seed-singularity --save

Usage

var Store = require('seed-sigularity').Store;
var store = new Store();

store.schema('posts', { grouping: ['author', 'category'] });

var recent = store.view('posts', function(params, cb) {
  $.ajax('/posts/recent?page=' + params.page).onSuccess(function(data) {
    cb(null, data);
  }).onError(function(error) {
    cb(error);
  });
}, { page: 0 });

var recentPosts = recent.fetch({ page: 0 }).items; // sync return
console.log(recentPosts); // [] - empty array at first

// after some time
console.log(recentPosts); // [{...},{...},...]

store.get('posts', '123'); // { _id: '123', ... }
store.query('posts', 'category', 'work'); // [{...}, {...}]

Development

$ git clone git@github.com:seedalpha/singularity.git
$ cd singularity
$ npm install
$ npm test

Naming

The technological singularity hypothesis is that accelerating progress in technologies will cause a runaway effect wherein artificial intelligence will exceed human intellectual capacity and control, thus radically changing or even ending civilization in an event called the singularity.

Author

Vladimir Popov vlad@seedalpha.net

License

©2015 Seedalpha

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.6.11
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.6.11
    0
  • 1.6.1
    0

Package Sidebar

Install

npm i @seedalpha/singularity

Weekly Downloads

0

Version

1.6.11

License

©2014 Seedalpha

Unpacked Size

13.3 kB

Total Files

8

Last publish

Collaborators

  • tom.raggett.trcuk.com
  • ac_inc