I'm extremely stupid and didn't commit as I go. To anyone reading this I'm extremely sorry. A lot of these changes are very broad and I plan on releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm afraid I couldn't wait. If you're ever in London I'll buy you a beer (or assorted beverage!) to make up for it, also I'll kiss your feet and give you a back massage, maybe.
27 lines
480 B
JavaScript
27 lines
480 B
JavaScript
/* @flow */
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|