Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.defineProperty(this, propName, {
configurable: true,
set(value) {
Core.record(new PropSnapshot(this, propName, this[sym], value));
this[sym] = value;
},
get() {
return this[sym];
}
});
},
get() {}
});
}
if (config.persistTimeTravel) S.regConstructor(Core.TraceData);
else S.regConstructor(Core.TraceData, S.NotSerializableDescriptor);
};
PropSnapshot.prototype.call = config.timeTravelForward
? function(this: IPropSnapshot) {
if (this.back) {
if (this.oldValue === deleteTag) delete this.target[this.index];
else this.target[this.index] = this.oldValue;
} else this.target[this.index] = this.newValue;
this.back = !this.back;
Core.record(this);
}
: function(this: IPropSnapshot) {
if (this.oldValue === deleteTag) delete this.target[this.index];
else this.target[this.index] = this.oldValue;
};
S.regConstructor(PropSnapshot);
/**
* defines setter a getter in `value` to support time travel
* TODO: delete handler
*/
export function propHack(value: any, propName: string) {
const sym = Symbol(`${propName}`);
Object.defineProperty(value, propName, {
set(value) {
this[sym] = value;
Core.record(new PropSnapshot(this, propName, deleteTag, value));
Object.defineProperty(this, propName, {
configurable: true,
set(value) {
Core.record(new PropSnapshot(this, propName, this[sym], value));
this[sym] = value;
R.constructors.forEach(v => S.regConstructor(v));
export const asyncFunction = R.makeAsyncFunctionConstructor(S.regConstructor);