new Store(id)
This class is meant to be sub-classed using Store.createClass
Parameters:
| Name | Type | Description |
|---|---|---|
id |
* | Anything serializable as JSON |
- Source:
Members
-
(static) Store.dispatcherIndex
-
- Source:
Properties:
Type Description Number
Methods
-
(static) Store.addChangeListener(id)
-
Parameters:
Name Type Description idStore#id - Source:
-
(static) Store.createClass(proto)
-
Creates a new class that inherits from Store
Parameters:
Name Type Description protoObject Prototype of new child class - Source:
Example
var MyStore = Marbles.Store.createClass({ displayName: "MyStore", getInitialState: function () { return { my: "state" }; }, willInitialize: function () { // do something }, didInitialize: function () { // do something }, didBecomeActive: function () { // do something }, didBecomeInactive: function () { // do something }, handleEvent: function (event) { // do something } }); -
(static) Store.discardInstance(store)
-
Give Store instance up for garbage collection
Parameters:
Name Type Description storeMarbles.Store - Source:
-
(static) Store.expectChangeListener(id)
-
Force store to remain active until the next change listener is added
Parameters:
Name Type Description idStore#id - Source:
-
(static) Store.registerWithDispatcher(dispatcher)
-
Parameters:
Name Type Description dispatcherMarbles.Dispatcher - Source:
-
(static) Store.removeChangeListener(id)
-
Parameters:
Name Type Description idStore#id - Source:
-
(static) Store.unexpectChangeListener(id)
-
Undo expectation from expectChangeListener
Parameters:
Name Type Description idStore#id - Source:
-
didBecomeActive()
-
Called when first change listener is added
- Source:
-
didBecomeInactive()
-
Called when last change listener is removed and when the instance is otherwise perceived as inactive
- Source:
-
didInitialize()
-
Called after state is initialized
- Source:
-
getInitialState() → {Object}
-
- Source:
Returns:
Initial state object- Type
- Object
-
handleEvent(event)
-
Called with Dispatcher events
Parameters:
Name Type Description eventObject - Source:
-
willInitialize()
-
Called before state is initialized
- Source: