Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

0.1.0

Choose a tag to compare

@kenwheeler kenwheeler released this 04 Mar 16:34
· 22 commits to master since this release

Breaking Changes

Action Creator syntax now requires explicit dispatches, see example below:

// OLD WAY

biff.createActions({
    myAction: function(arg1){
        return {
            actionType: 'MY_ACTION',
            prop1: arg1
        }
    }
});

// NEW WAY

biff.createActions({
    myAction: function(arg1){
        this.dispatch({
            actionType: 'MY_ACTION',
            prop1: arg1
        });
    }
});

New Features

Stores

Stores in Biff now have store state helpers. Each store object has a _pending property and an _errors array. These are exposed via the following getters and setters:

// Inside components, etc...
MyStore.getPending() // Returns _pending property
MyStore.getErrors() // Returns _errors array

// Inside a store's payload callback
this._setPending(value) // Sets the _pending property
this._setError(error) // Pushes an error onto the _errors array
this._clearErrors() // Clears the store's _errors array

In addition to stores being able to store errors, they can also emit errors back to the component using the emitChange method. Components can respond to this event using the storeError method.

// In a store's payload callback
if(error) {
    this.emitError(error);
}

// In a component
mixins: [MyStore.mixin],
storeError: function (error) {
    console.log(error);
}