closes #1294
This commit is contained in:
parent
b2cedf7b0a
commit
ade541bd61
2 changed files with 4 additions and 3 deletions
|
@ -1,8 +1,9 @@
|
|||
function spy(func) {
|
||||
|
||||
function wrapper(...args) {
|
||||
// using ...args instead of arguments to store "real" array in wrapper.calls
|
||||
wrapper.calls.push(args);
|
||||
return func.apply(this, arguments);
|
||||
return func.apply(this, args);
|
||||
}
|
||||
|
||||
wrapper.calls = [];
|
||||
|
|
|
@ -1 +1 @@
|
|||
Here we can use `calls.push(args)` to store all arguments in the log and `f.apply(this, args)` to forward the call.
|
||||
The wrapper returned by `spy(f)` should store all arguments and then use `f.apply` to forward the call.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue