I'd like if the library had an API to hook into method calls. Imagine a toast.error is called and I'd like to capture the error via telemetry globally for any instance of that method call.
I know I can work around this by:
- creating a helper function
- monkey-patching
.error
Could we have a global API which would allow me to hook into the methods? Using events would be ok:
toast.addEventListener('toast_error', (err) => /* call custom code */)
toast.removeEventListener(/* you get the idea */)
or even something like:
toast.setup({
onError: (err) => /* call custom code */
})
I'm mentioning the error style of toasts, but I can imagine being able to intercept any kind of event.
I'd like if the library had an API to hook into method calls. Imagine a
toast.erroris called and I'd like to capture the error via telemetry globally for any instance of that method call.I know I can work around this by:
.errorCould we have a global API which would allow me to hook into the methods? Using events would be ok:
or even something like:
I'm mentioning the error style of toasts, but I can imagine being able to intercept any kind of event.