Calling a method on load

How would I go about to call a method as soon as the app loads (without user interaction) or alternatively as soon as a specific page has loaded?

I want to automatically load settings and update some details in the UI without having the user clicking a button.

SOLVED: Stumbled upon the solution: https://www.fusetools.com/developers/guides/topics/appclass

Linked page no longer exists.

This is the new link of App Class
https://docs.fusetools.com/fuse/app.html

Thanks jesusmartinoza. Not sure if you or anyone else knows, but whatever Anders Sivesind saw in the older documentation was not apparent to me in the new documentation.

At first I though an <OnUpdate/> tag could be used to trigger loading js code, but no such function name actually exists.

Then I tried adding:

// {config} coming from a .js file loaded earlier
<OnUserEvent Name="finished" Handler="{config}"/>
<PageLoaded>
    <RaiseUserEvent EventName="finished"/>
</PageLoaded>

But this also did not work. Is there not something equivalent to:

// jquery
$(document).ready(function() {
    console.log("Ready!");
});

To execute JS code to configure user stuff you can use it like this:

<App>
  <JavaScript>
    // JavaScript executed on app startup
  </JavaScript>

  <!--- You regular app UI -->
</App>

Or if you want more control over the app, Life Cycle module is for you :slight_smile:

Thanks! Using the <JavaScript> tag is working best for me. I haven’t had any luck with the Lifecycle module when using Fuse Studio / viewport. Works fine on a device, but I didn’t want to have to build out all the time.