Skip to content

A tool for building js frameworks that allow a client side app to go offline and sync when online

License

Notifications You must be signed in to change notification settings

doweber/jsActiveModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsActiveModel

*What is it?* A model layer for client side javascript frameworks to be able to save data to the client and sync to a server side API when a connection is available.

Example:

//In your controller Post.set(post_data, function(data){

alert(data);

});

//Your Model var Post =function(){

function initPost(){
  $(this).jsActiveModel('init');
}

function getPost(cb){
  url = BASE + '/api/b/get.json';
  $(this).jsActiveModel('get', url, cb);
}

function setPost(post_data, cb){
  url = BASE + '/api/b/post.json';
  $(this).jsActiveModel('create', post_data, url, cb);
}

function updatePost(){
  url = BASE + '/api/b/update.json';
  $(this).jsActiveModel('update', post_data, url, cb);
}

function deletePost(){
  url = BASE + '/api/b/destroy.json';
  $(this).jsActiveModel('destroy', url, cb);
}

return {
  DBTABLE : 'post',
  DBCOLUMNS : 'id, name, body, created_at, updated_at,
  IS_SYNCABLE : true,
  init: initPost,
  set: setPost,
  get: getPost,
  update: updatePost,
  destroy: deletePost
}

}();

About

A tool for building js frameworks that allow a client side app to go offline and sync when online

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •