# Store QML Type

Store Component. More...

- List of all members, including inherited members

## Properties

- bindSource : object
- filterFunctionEnabled : bool
- redispatchTargets : array

## Signals

- dispatched(string type, object message)

## Detailed Description

Store is a helper item for implement the data “Store” component in a Quick Flux application. It could listen from ActionCreator / Dispatcher component and redispatch the received action to another store components (e.g children store).

It is a replacement of AppListener component

Example:

    import QuickFlux 1.1

    Store {
      bindSource: AppDispatcher

      Filter {
        type: ActionTypes.addItem
        onDispatched: {
          /// Process
        }
      }

    }

The order of action delivery:

    Store {
      id: rootStore

      bindSource: AppDispatcher

      property alias page1 : page1

      Store {
        id: page1
      }

      Store {
        id: page2
      }

      Filter {
        id: filter1
      }

    }

In the example above, the rootStore is bind to AppDispatcher, whatever the dispatcher dispatch an action, it will first re-dispatch the action to its children sequentially. Then emit the dispatched signal on itself. Therefore, the order of receivers is: page1, page2 then filter1.

If the redispatchTargets property is set, Store component will also dispatch the received action to the listed objects.

## Property Documentation

bindSource : object

This property holds the source of action. It can be an ActionCreator / Dispatcher component

The default value is null, and it listens to AppDispatcher

filterFunctionEnabled : bool

If this property is true, whatever the store component received a new action. Beside to emit a dispatched signal, it will search for a function with a name as the action. If it exists, it will call also call the function.

    Store {
      filterFunctionEnabled: true

      function addItem(message) {
      }
    }

The default value is false

redispatchTargets : array

By default, the Store component redispatch the received action to its children sequentially. If this property is set, the action will be re-dispatch to the target objects too.

    Store {
        id: bridgeStore

        redispatchTargets: [
            SingletonStore1,
            SingletonStore2
        ]
    }

## Signal Documentation

dispatched(string type, object message)

This signal is emitted when a message is received by this store.

There has two suggested methods to listen this signal:

Method 1 - Use Filter component

    Store {
        Filter {
            type: ActionTypes.addItem
            onDispatched: {
                // process here
            }
        }
    }

Method 2 - Use filter function

    Store {
        filterFunctionEnabled: true

        function addItem(message) {

        }
    }

Note: The corresponding handler is `onDispatched`.