Skip to content

Instantly share code, notes, and snippets.

@clarkio
Created June 19, 2019 23:21
Show Gist options
  • Save clarkio/51f314c5c5ac0ec41c3e098bee5997f8 to your computer and use it in GitHub Desktop.
Save clarkio/51f314c5c5ac0ec41c3e098bee5997f8 to your computer and use it in GitHub Desktop.
@parithon's example of binding this to resolve the issue with our tests for these functions while attempting to wrap in a spy from sinonjs
function startMonitoring(milliseconds) {
return getStatusEvery.bind(this).(milliseconds)
}
function getStatusEvery(milliseconds) {
this.getStreamStatus();
return setInterval(this.getStreamStatus, milliseconds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment