mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 16:26:08 +08:00
27 lines
883 B
Plaintext
27 lines
883 B
Plaintext
|
import SerializableRegistry from './serializable-registry'
|
||
|
|
||
|
class StoreRegistry extends SerializableRegistry {
|
||
|
/**
|
||
|
* Most of the core Flux stores construct themselves on require. That
|
||
|
* construction initialize the stores, sets up listeners, and may access
|
||
|
* the database.
|
||
|
*
|
||
|
* It also kicks off a fairly large tree of require statements that
|
||
|
* takes considerable time to process.
|
||
|
*/
|
||
|
activateAllStores() {
|
||
|
for (const name in this._constructorFactories) {
|
||
|
if (this._constructorFactories.hasOwnProperty(name)) {
|
||
|
// All we need to do is hit `require` on the store. This will
|
||
|
// construct the object an initialize the require cache. The
|
||
|
// stores are now available in nylas-exports or from the node
|
||
|
// require cache.
|
||
|
this.get(name)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const registry = new StoreRegistry()
|
||
|
export default registry
|