Invoking the callback in JavaScript will queue the Go function fn for execution.
This execution happens asynchronously on a special goroutine that handles all callbacks and preserves
the order in which the callbacks got called.
As a consequence, if one callback blocks this goroutine, other callbacks will not be processed.
A blocking callback should therefore explicitly start a new goroutine.

Callback.Release must be called to free up resources when the callback will not be used any more.

NewEventCallback returns a wrapped callback function, just like NewCallback, but the callback expects to have
exactly one argument, the event. Depending on flags, it will synchronously call event.preventDefault,
event.stopPropagation and/or event.stopImmediatePropagation before queuing the Go function fn for execution.

const (
// PreventDefault can be used with NewEventCallback to call event.preventDefault synchronously.PreventDefaultEventCallbackFlag = 1 << iota// StopPropagation can be used with NewEventCallback to call event.stopPropagation synchronously.StopPropagation// StopImmediatePropagation can be used with NewEventCallback to call event.stopImmediatePropagation synchronously.StopImmediatePropagation
)

New uses JavaScript's "new" operator with value v as constructor and the given arguments.
It panics if v is not a function.
The arguments get mapped to JavaScript values according to the ValueOf function.