Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow. Closes #3064
25 lines
467 B
JavaScript
25 lines
467 B
JavaScript
export default class Store extends Map {
|
|
constructor() {
|
|
super();
|
|
this.dynamicData = {};
|
|
}
|
|
|
|
dynamicData: Object;
|
|
|
|
setDynamic(key, fn) {
|
|
this.dynamicData[key] = fn;
|
|
}
|
|
|
|
get(key: string): any {
|
|
if (this.has(key)) {
|
|
return super.get(key);
|
|
} else {
|
|
if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
|
|
let val = this.dynamicData[key]();
|
|
this.set(key, val);
|
|
return val;
|
|
}
|
|
}
|
|
}
|
|
}
|