telex

0.0.1 • Public • Published

Features

  • Makes your application run offline
  • Ability to save data to local storage, and persist to a server later on.
var app   = require("telex")(),
teachers  = app.collection("teachers" , TeacherModel),
schools   = app.collection("schools"  , SchoolModel);

// store locally
schools.sync(app.stores.local("schools"));

// hook up with some pubsub service, and go the other way too
schools.sync(app.stores.pubsub("schools"));

// custom sync - probably an API?
schools.sync({

  // delay 
  delay: 1000,
  
  // update an item
  update : function (items, query, next) {
  },
  
  // create an item
  insert : function (items, next) {
  },
  
  // find an item
  find   : function (query, next) {
  },
  
  // remove an item
  remove : function (query, next) {
  }
});


// stored locally
schools.insert({ name: "Some School", teacher: teacherId });

API

telex()

creates a new telex app

telex.collection(name, modelClass)

Creates a new collection

collection.insert(items, next)

inserts a new item

collection.update(query, options, next)

updates an item, or many items

collection.find(query, options, next)

finds items

collection.remove(query, options, next)

removes an item

collection.sync(collection)

syncs with another collection

collection.persist(items)

internal function that's called by the collection persisting to the target collection

collection.on(event, listener)

listens for events:

  • save - emitted with calling insert, update, or remove
  • persist -

Readme

Keywords

none

Package Sidebar

Install

npm i telex

Weekly Downloads

0

Version

0.0.1

License

BSD-2-Clause

Last publish

Collaborators

  • architectd
  • crcn