tracked
Version:
A 300 byte @tracked property decorator for Preact.
2 lines (1 loc) • 456 B
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.tracked=e()}(this,function(){function t(t,e,n){function i(){var t=this;return Object.defineProperty(this,e,{configurable:!0,get:function(){return t.state[e]},set:function(n){o[e]=n,t.setState(o)}}),this.state[e]=n.initializer()}var o={};return{configurable:!0,set:function(t){i.call(this),this[e]=t},get:i}}return t});