UNPKG

ez-observable

Version:

Make class fields reactive in React with a single decorator + hook

2 lines (1 loc) 334 B
import{ObservableHelper as t}from"../internal/index.js";function n(o,s){const{name:r}=s;return{get(){const e=t.for(this);return e.hasProperty(r)||e.setPropertyValue(r,o.get.call(this),!0),e.getPropertyValue(r)},set(e){t.for(this).setPropertyValue(r,e)},init(e){return t.for(this).setPropertyValue(r,e,!0),e}}}export{n as observable};