Callback inside function

I prefer an event dispatcher, as I’ve suggested above.

  1. You call the function Login:

  1. Then you execute your Login function:

  1. Then send a callback to the widget with the event dispatcher:

  1. And catch it in the widget: