Skip to content

Make ComposerJs compatible with Flux #42

@dchambers

Description

@dchambers

I'd like to add a 'Flux Compatibility' section with the following contents:

Flux Compatibility

Flux apps can use ComposerJs models as the basis for Flux stores, as follows:

  • Each model will be encapsulated within a store using composerjs.createModel().
  • The store will register itself with the global dispatcher.
  • Stores will either avoid the use of handlers that invoke hasUpdated(), or will dispatch an action within the stores on('internal-update') call-back, rather than invoking processUpdates() directly.

This would require us to make the following changes:

  1. Stop using ASAP to automatically process updates, and instead require a new model.processUpdates() method to be fired — this is related to QUESTION: Should we get rid of ASAP? #38.
  2. Create a new internal-update callback that fires after hasUpdated() has been invoked, and use ASAP to ensure it only fires once, allowing non Flux apps to simply invoke model.processUpdates() when the event fires.
  3. Rename model.notifyListeners() to model.processUpdates() as it's the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions