import {trackValue} from "../decorator-utils/track-value";


/**
 * Decorate a variable as part of the component-state, and will thus trigger a re-render whenever it is changed
 */
export function state() {
    return function decorator(target, key, descriptor){
        // Dev-note: Tis is run for every instance made of the decorated class ...
        // console.log("State " + key, target);
        return trackValue({target, key, descriptor}, function(value){ this.markDirty && this.markDirty() });
    }
}