1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1× 1× 1× 252× 252× 252× 1× 3× 1× | import { Spy } from "./spy"; export class RestorableSpy extends Spy { private _functionName: string; private _target: any; public constructor(target: any, functionName: string) { super(target[functionName], target); this._functionName = functionName; this._target = target; } public restore() { this._target[this._functionName] = this.originalFunction; } } |