我想监视一个函数,然后在函数完成/初始调用时执行回调。
以下内容有些简单,但显示了我需要完成的工作:
//send a spy to report on the soviet.GoldenEye method function
var james_bond = sinon.spy(soviet, "GoldenEye");
//tell M about the superWeapon getting fired via satellite phone
james_bond.callAfterExecution({
console.log("The function got called! Evacuate London!");
console.log(test.args);
});
Run Code Online (Sandbox Code Playgroud)
在锡农有可能这样做吗?如果他们解决了我的问题,也欢迎备用库:)