func (dom *DOM) NewJsEventFuncAsync(fn func(event js.Value), async bool) js.Func {
	return js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		event := args[0]
		event.Call("preventDefault")
		runFn := func() {
			defer dom.AlertOnPanic()
			fn(event)
		}
		switch {
		case async:
			go runFn()
		default:
			runFn()
		}
		return nil
	})
}
// NewJsEventFuncAsync performs similarly to NewJsEventFunc, but calls the event-handling function asynchronously if async is true.
NewJsEventFuncAsync performs similarly to NewJsEventFunc, but calls the event-handling function asynchronously if async is true.
// NewJsEventFuncAsync performs similarly to NewJsEventFunc but calls the event - handling function asynchronously if async is true .
func (dom *DOM) NewJsEventFuncAsync(fn func(event js.Value), async bool) js.Func {
	return js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		event := args[0]
		event.Call("preventDefault")
		runFn := func() {
			defer dom.AlertOnPanic()
			fn(event)
		}
		switch {
		case async:
			go runFn()
		default:
			runFn()
		}
		return nil
	})
}
func ( dom * DOM ) NewJsEventFuncAsync ( fn func ( event js . Value ) , async bool ) js . Func { return js . FuncOf ( func ( this js . Value , args [ ] js . Value ) interface { } { event := args [ 0 ] event . Call ( " " ) runFn := func ( ) { defer dom . AlertOnPanic ( ) fn ( event ) } switch { case async : go runFn ( ) default : runFn ( ) } return nil } ) }
NewJsEventFuncAsync performs similarly to NewJsEventFunc, but calls the event-handling function asynchronously if async is true.
NewJsEventFuncAsync performs similarly to NewJsEventFunc but calls the event - handling function asynchronously if async is true .