Skip to content

Document the Flux dispatcher for non Flux users #126

Open

Description

@tanzim

Hi,
We don't use Flux for our application, but still had to hook into it to receive stormpath events for login/logout etc.
While it wasn't a big deal, it required digging around the sources to see what evens were generated and how to get hold of the dispatcher itself. It would be nice if an example was provided?

In case someone else is wondering the same, what we ended up doing was something like this:

import stormpath, { context, constants } from 'react-stormpath';
// Initializing stormpath initializes the context, which has the dispatcher...
stormpath.init();
// Which is returned via getDispatcher on the context
var dispatcher = context.getDispatcher();
// And then use register to listen to events dispatched
dispatcher.register((data) => {
  const { options, type } = data;
  if (type === constants.USER_SET) {...}
});

Activity

  1. rorheden commented on Oct 14, 2016

    @rorheden
    Contributor

    Thank you for reporting this and awesome that you figured it out yourself!

    This is definitely something we have overlooked and that we need to improve on.

    I have tagged this as an enhancement, so once we have some time over we'll fix it! :)

    Again, thanks and hope you have an awesome weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions