Mostbet  |   Blog  |   Sitemap  |   Search  
Home
JavaScript UI FrameworkTutorialsTechnical ArticlesAmple SDK Application Lifetime

Ample SDK Application Lifetime

This document covers the client-side (front-end) lifetime of the Ample SDK application.

Boot-time

The Ample SDK application boot-time starts as soon as the user navigates to a URL with empowered content and ends right before web browser dispatches the onload event. During this the time web browser loads the page and the resources known to it, it parses HTML, CSS, creates the HTML DOM and executes scripts.

When the Ample SDK runtime is loaded by the web browser, the uninitialized ample document object is created. The markup language implementation files will get executed next.

Build-time

Now that the browser has loaded the entire page and its resources, it dispatches the onload event. Ample SDK gets notified and the build-time starts.

First Ample SDK searches through the page to see if there are any stylesheets (link or style tags) with the text/ample+css mime-type on the page. When found, it will load and process those resources.

Next, Ample SDK looks for UI fragments (script tags) with the application/ample+xml mime-type. It parses these fragments one by one, adds them to its own DOM (Document Object Model) structure, renders to the web browser's DOM and notifies fragments of their readiness by dispatching a load event to their roots.

Finally Ample SDK dispatches a load event to the ample object notifying the application that the run-time is about to begin. The application can now be sure that the UI is built, rendered and interactive. From now on all primitive UI events originated in the web browser's DOM will get re-dispatched into the Ample SDK's DOM.

Run-time

The Ample SDK run-time kicks in right after the load event and lasts until the unload event.

Dispose-time

The dispose-time starts as soon as the user attempts to navigate away from the page. The web browser will dispatch an unload event to its document. Ample SDK will get immediately notified and will re-dispatch unload event first to all UI fragments and then to the ample document object.