You have to define the Go function you want to call on the event DOMContentLoaded as a member function of the App structure, for instance:
func (a *App) OnDOMContentLoaded(arg1 string) string {
return arg1;
}
After compiling, this function will be available on the "frontend\wailsjs\go\main\App.js" file, and you can import it from your JS/TS files:
// assuming your JS file is in "frontend/src".
import {OnDOMContentLoaded} from '../wailsjs/go/main/App';
The compiled Go functions imported from JS return a promise with their return value. Then, inside your JS source, you just have to call the imported function on the listener of the DOMContentLoaded event:
You have to define the Go function you want to call on the event
DOMContentLoadedas a member function of theAppstructure, for instance:After compiling, this function will be available on the "frontend\wailsjs\go\main\App.js" file, and you can import it from your JS/TS files:
The compiled Go functions imported from JS return a promise with their return value. Then, inside your JS source, you just have to call the imported function on the listener of the
DOMContentLoadedevent: