Lifecycle | AIUI | Rokid

The lifecycle of an AIUI page follows a fixed calling order. When a page is opened for the first time, onLoad → onShow → onReady are triggered in sequence. When navigatin…

Lifecycle

The lifecycle of an AIUI page follows a fixed calling order. When a page is opened for the first time, onLoad → onShow → onReady are triggered in sequence. When navigating to another page, the current page triggers onHide, and when switching back it triggers onShow. When the page is destroyed, onUnload is triggered.

Lifecycle Callback Table

CallbackDescriptionTrigger Timing
onLoadListens for page loadTriggered when the page loads, once per page instance
onShowListens for page displayTriggered when the page is displayed or brought to the foreground
onReadyListens for the first render completion of the pageAfter the first frame containing the initial view is presented, once per page instance
onHideListens for the page being hiddenTriggered when the page is hidden or moved to the background
onUnloadListens for page unloadTriggered when the page is unloaded

Lifecycle Demo

Sequence: creation onLoad → display onShow → first-frame presentation onReady; later onHide / onShow cycles end with onUnload.

Callback Details

onLoad(Object query)

Triggered when the page loads. A page is only called once, and you can get the parameters in the current page path through the parameter of onLoad.

onShow()

Triggered when the page is displayed or brought to the foreground.

onReady()

Runs once per instance after the first frame containing the initial view is actually presented. Template parsing or completed layout alone does not trigger onReady. Returning to an existing page and later setData() calls do not repeat it. Instances unloaded before presentation do not receive a late callback.

onHide()

Triggered when the page is hidden or moved to the background.

onUnload()

Triggered when the page is unloaded, for example when navigating to another page and destroying the current page.

Recommended Reading

  • Page Overview
  • Page Definition
  • Events