1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 |
|
5 | var _map = require("babel-runtime/core-js/map");
|
6 |
|
7 | var _map2 = _interopRequireDefault(_map);
|
8 |
|
9 | var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
10 |
|
11 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
12 |
|
13 | var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
14 |
|
15 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
16 |
|
17 | var _inherits2 = require("babel-runtime/helpers/inherits");
|
18 |
|
19 | var _inherits3 = _interopRequireDefault(_inherits2);
|
20 |
|
21 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22 |
|
23 | var Store = function (_Map) {
|
24 | (0, _inherits3.default)(Store, _Map);
|
25 |
|
26 | function Store() {
|
27 | (0, _classCallCheck3.default)(this, Store);
|
28 |
|
29 | var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this));
|
30 |
|
31 | _this.dynamicData = {};
|
32 | return _this;
|
33 | }
|
34 |
|
35 | Store.prototype.setDynamic = function setDynamic(key, fn) {
|
36 | this.dynamicData[key] = fn;
|
37 | };
|
38 |
|
39 | Store.prototype.get = function get(key) {
|
40 | if (this.has(key)) {
|
41 | return _Map.prototype.get.call(this, key);
|
42 | } else {
|
43 | if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
|
44 | var val = this.dynamicData[key]();
|
45 | this.set(key, val);
|
46 | return val;
|
47 | }
|
48 | }
|
49 | };
|
50 |
|
51 | return Store;
|
52 | }(_map2.default);
|
53 |
|
54 | exports.default = Store;
|
55 | module.exports = exports["default"]; |
\ | No newline at end of file |