Repository navigation
3. Application flow
Marcos Vinícius edited this page Aug 11, 2022
·
3 revisions
As you noticed, an index.html page was created.
On this page, we should have the references to the scripts that were generated directly by the compilation
(Preferably do this inside the <header/> tag)
<header>
...
<script src="/Objective-UI.js"></script>
<script src="/App.js"></script>
<script src="/HelloWorld.js"></script>
<!-- ... anothers -->
</header>Note that we are directly referencing the Objective-UI base library,
which contains all framework features and access to standard controls
and also our project files which are consuming the library
Next, we need to establish a main container for our application, identified by an id
<main id="app" class="container-fluid">
<!-- app will appear here -->
</main>And finally, we'll need to make a JS call to the file that contains the code that initializes everything else in the application:
<script>
//app "start-point"
new App(document);
</script>The complete body needed for this is:
<body>
<main id="app" class="container-fluid">
<!-- app will appear here -->
</main>
<script>
//app "start-point"
new App(document);
</script>
</body>import { HelloWorld } from "./Helloworld";
import { DefaultExceptionPage, UIPage } from "./Objective-UI";
export class App extends UIPage // 1 - Here we define an 'App' class that inherits UIPage
{ // UIPage is a super-class that will initialize the rest of the library and allow our App class to
// customize features. Here we will also navigate to the first View of the app
constructor(mainDoc: Document)
{
super(mainDoc); // 2 - Here is where the startup library
try
{
/*
* 3 - Note that we can also resolve the .js and .css dependencies that we will need
* This is the equivalent of manually importing these files into index.html
*/
//#region essential libs
this.importLib({
libName: 'jquery-3.6.0',
jsPath: 'jquery.min.js'
});
this.importLib({
libName: 'jquery-mask-1.14.16',
jsPath: 'jquery.mask.js'
});
this.importLib({
libName: 'fontawesome-free-5.15.3',
cssPath: 'css/all.min.css'
});
this.importLib({
libName: 'bootstrap-4.6.1',
cssPath: 'bootstrap.css',
jsPath: 'bootstrap.js'
});
//#endregion
// 4 - Navigate to HelloWorld (UIView) !
this.navigateToView(new HelloWorld());
}
catch (error)
{
new DefaultExceptionPage(error as Error);
}
}
}From here, our application is already working with a start page