Remove 'const char *target' parameter from event callback registration functions for which it doesn't make any sense. Add event callback registration for 'beforeunload' event.