noBackend / noBackend-app-invoice

example app to showcase implementations using different noBackend solutions
http://invoice.nobackend.org/
87 stars 21 forks source link

replace event based implementation of backends with Dreamcode #8

Closed gr2m closed 11 years ago

gr2m commented 11 years ago

In the spirit of noBackend, where we suggest that frontend developers use Dreamcode for functionalities their apps require and focus on what's unique to their apps instead, I'd like to implement our example app in exact the same way.

That means that instead of

App.on('invoice:save',   handleInvoiceSave);

var handleInvoiceSave = function(invoice) {
  invoices.setContent(invoice.id, invoice).then(function () {
    console.log('saved to remotestorage!');
  }, function (err) {
    console.log('failed to save to remotestorage ', err, invoice);
  });
};

we'd now do

// overwrite dreamcode with the real thing.
store.save = function(object) {
    invoices.setContent(invoice.id, invoice).then(function () {
      console.log('saved to remotestorage!');
    }, function (err) {
      console.log('failed to save to remotestorage ', err, invoice);
    });
}

This pull request fixes #7

silverbucket commented 11 years ago

+1 this looks good, I misunderstood your original comment. :)

gr2m commented 11 years ago

awesome, I'll finish it up then. Cheers!