In your code, the function alertHandler is in a narrow scope, so you need to get it out to the top level.
There is a similar question on this page with sample code. It may be helpful.
In your code, the function alertHandler is in a narrow scope, so you need to get it out to the top level.
There is a similar question on this page with sample code. It may be helpful.