Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the Store/Actions instance during create. #27

Merged
merged 1 commit into from
Feb 16, 2015

Conversation

tappleby
Copy link
Contributor

During testing I found my self with a lot of createActions / createStores followed by the matching getters.

This PR lets you use the following syntax

let flux = new Flux();
let sessionActions = flux.createActions('session', SessionActions);
let sessionStore = flux.createStore('session', SessionStore);

sessionActions.login(true);
assert.isTrue(sessionStore.isLoggedIn());

Might also be useful if you want to inject actions into stores directly

export default class Flux extends Flummox {
  constructor() {
    super();

    let stargazersActions = this.createActions('stargazers', StargazerActions);
    let globalActions = this.createActions('global', GlobalActions);

    this.createStore('stargazers', StargazerStore, stargazersActions, globalActions);
    this.createStore('app', AppStore, globalActions);
  }
}

acdlite added a commit that referenced this pull request Feb 16, 2015
Return the Store/Actions instance during create.
@acdlite acdlite merged commit 99b0e1d into acdlite:master Feb 16, 2015
@acdlite
Copy link
Owner

acdlite commented Feb 16, 2015

Awesome. Thanks!

@tappleby tappleby deleted the create-returns-instances branch February 16, 2015 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants