hadron-app-registry
Advanced tools
Comparing version
'use strict'; | ||
const Reflux = require('reflux'); | ||
const Action = require('./actions'); | ||
@@ -13,2 +14,8 @@ | ||
/** | ||
* Returning a fake store when asking for a store that does not | ||
* exist. | ||
*/ | ||
const STUB_STORE = Reflux.createStore(); | ||
/** | ||
* Is a registry for all user interface components, stores, and actions | ||
@@ -47,2 +54,3 @@ * in the application. | ||
this.roles = {}; | ||
this.storeMisses = {}; | ||
} | ||
@@ -171,3 +179,8 @@ | ||
getStore(name) { | ||
return this.stores[name]; | ||
const store = this.stores[name]; | ||
if (store === undefined) { | ||
this.storeMisses[name] = (this.storeMisses[name] || 0) + 1; | ||
return STUB_STORE; | ||
} | ||
return store; | ||
} | ||
@@ -174,0 +187,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/hadron-app-registry", | ||
"version": "5.3.0", | ||
"version": "6.0.0", | ||
"repository": { | ||
@@ -10,0 +10,0 @@ "type": "git", |
24806
1.38%494
2.49%