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

onStoreCreated return value with init #443

Merged
merged 2 commits into from Jun 21, 2018
Merged

onStoreCreated return value with init #443

merged 2 commits into from Jun 21, 2018

Conversation

ShMcK
Copy link
Member

@ShMcK ShMcK commented Jun 21, 2018

Returning an object from onStoreCreated will merge into the store.

This can be useful for plugins such as select, which are bound to a store.

Example:

const pluginWithReturn = {
  onStoreCreated: () => {
    return {
      returned: 42,
     }
  },
}

const store = init({
  plugins: [pluginWithReturn],
})

expect(store.returned).toEqual(42)

TODO

  • prevent invalid return values from onStoreCreated
  • update docs

@ShMcK ShMcK merged commit 2a74201 into master Jun 21, 2018
@ShMcK ShMcK deleted the feature/plugin-return branch June 21, 2018 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant