Skip to content

xiejuntao/demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy and paste the following to add behaviour to the demo-dummy:

var hoodie  = new Hoodie("http://api.appjs.dev");

hoodie.store.on('add:task', function(object) {
  $('.taskList').append('<li>'+object.desc+'</li>');
});

$('.addTask .submit').click(function(event){
    event.preventDefault();
    var desc = $('.addTask .desc').val();
    hoodie.store.add('task', {desc: desc});
});

$('.signUp .submit').click(function(event){
    event.preventDefault();
    var username = $('.signUp .username').val();
    var password = $('.signUp .password').val();
    hoodie.account.signUp(username, password).done(function(object){
        $('#modal').modal('hide');
        $('.welcome').text('Hello, '+hoodie.account.username);
    });
});

$('.signIn .submit').click(function(event){
    event.preventDefault();
    var username = $('.signIn .username').val();
    var password = $('.signIn .password').val();
    hoodie.account.signIn(username, password).done(function(object){
        $('#modal').modal('hide');
        $('.welcome').text('Hello, '+hoodie.account.username);
    });
});

hoodie.store.findAll('task').done(function(tasks){
  $('.taskList').empty()
  tasks.forEach( function( task ){
    $('.taskList').append('<li>'+task.desc+'</li>');
  });
});

About

The live demo for Hoodie presentations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published