TraceKit icon indicating copy to clipboard operation
TraceKit copied to clipboard

Better window.onerror toggle api (.collectWindowErrors)

Open devinrhode2 opened this issue 13 years ago • 1 comments

In another library I was working on, I figured a very seamless way to offer a boolean toggle is to just have a function that you pass in true/false.

My proposal is changing collectWindowErrors to be a function instead of boolean switch like: TraceKit.collectWindowErrors(false) Then, when you turn off window errors, we also restore the previous window.onerror handler, when you turn them on, we restore our handler.

Any tweaks or good to go?

devinrhode2 avatar Dec 30 '12 22:12 devinrhode2

@devinrhode2, why not just have it so you have to buy into wiring up to global event handlers?

niemyjski avatar May 13 '15 22:05 niemyjski