function test() {
//your work with state
test._state = {}; //reset state
}
Object.defineProperties(test, {
_state: {
enumerable: false,
writable: true,
value: {}
},
t1: {
get: function() {
test._state.t1 = true;
return test;
}
},
t2: {
get: function() {
test._state.t2 = true;
return test;
}
}
});