1 | "use strict";
|
2 | var hmr_store_1 = require('./hmr-store');
|
3 | function HmrState(namespaceOrConfig, config) {
|
4 | function decoratorFactory(target, decoratedPropertyName, descriptor) {
|
5 | var key = namespaceOrConfig || target.constructor.name + '#' + decoratedPropertyName;
|
6 | hmr_store_1.HmrStore.select(key, function () { return hmr_store_1.HmrStore.get(key); });
|
7 | Object.defineProperty(target, decoratedPropertyName, {
|
8 | get: function () { return hmr_store_1.HmrStore.get(key); },
|
9 | set: function (newValue) {
|
10 | var currentValue = hmr_store_1.HmrStore.get(key);
|
11 | if (!currentValue) {
|
12 | hmr_store_1.HmrStore._initialValues[key] = newValue;
|
13 | }
|
14 | else {
|
15 | newValue = Object.assign(newValue, currentValue);
|
16 | }
|
17 | return hmr_store_1.HmrStore.set(key, newValue);
|
18 | },
|
19 | enumerable: true,
|
20 | configurable: true
|
21 | });
|
22 | return descriptor;
|
23 | }
|
24 | return decoratorFactory;
|
25 | }
|
26 | exports.HmrState = HmrState;
|
27 |
|
\ | No newline at end of file |