var Fleur = require('..');

var Foo = Fleur.actions('foo', {
  synchronous: function(state) {
    return Fleur.assign(state, {
      status: 'pending'
    });
  },
  asynchronous: function(state, dispatch) {
    dispatch(Foo.synchronous());
    return Fleur.promise(function(resolve) {
      setTimeout(function() {
        resolve(Fleur.assign(state, {
          items: [
            { title: 'foo', id: 1 },
            { title: 'bar', id: 2 },
            { title: 'baz', id: 3 }
          ],
          status: 'success'
        }));
      }, 100);
    });
  }
});

var store = Fleur.store();
store.dispatch(Foo.asynchronous())
  .then(function() {
    console.log(store.getState());
  });

var Fleur = require('..');

var Foo = Fleur.actions('foo', {
  synchronous: function(state) {
    return Fleur.assign(state, {
      status: 'pending'
    });
  },
  asynchronous: function(state, dispatch) {
    dispatch(Foo.synchronous());
    return Fleur.promise(function(resolve) {
      setTimeout(function() {
        resolve(Fleur.assign(state, {
          items: [
            { title: 'foo', id: 1 },
            { title: 'bar', id: 2 },
            { title: 'baz', id: 3 }
          ],
          status: 'success'
        }));
      }, 100);
    });
  }
});

var log = function(object) {
  console.log(JSON.stringify(object, null, 2));
};

var store = Fleur.store();
store.dispatch(Foo.asynchronous())
  .then(function() {
    log(store.getState());
  });

Add a custom `log` to the example
Add a custom `log` to the example
