@web-atoms/core
Version:
34 lines (33 loc) • 965 B
JavaScript
System.register(["./AtomBinder", "./AtomWatcher"], function (_export, _context) {
"use strict";
var AtomBinder, AtomWatcher;
function WatchProperty(target, key, descriptor) {
const {
get
} = descriptor;
const isSetup = Symbol.for(`isSetup${key}`);
return {
get: function () {
const watcher = new AtomWatcher(this, get, () => {
AtomBinder.refreshValue(this, key);
}, this);
watcher.init(false);
this.registerDisposable(watcher);
this[isSetup] = watcher;
Object.defineProperty(this, key, descriptor);
return get.apply(this);
},
configurable: true
};
}
_export("default", WatchProperty);
return {
setters: [function (_AtomBinder) {
AtomBinder = _AtomBinder.AtomBinder;
}, function (_AtomWatcher) {
AtomWatcher = _AtomWatcher.AtomWatcher;
}],
execute: function () {}
};
});
//# sourceMappingURL=WatchProperty.js.map