Bootstrapping

Introduction

To boot an EJS application, you must first include the pre-compiled bootstrap script. The bootstrap script is responsible for providing file loading, parsing, and dependency management.

The bootstrap script is located at: ElentraJS/elentrajs.js

How It Works

The bootstrap script is simply a collection of classes from the EJS library included in a bundle.

The Bootstrap Class

Synopsis

class Bootstrap {
    constructor(string srcPath, Object environmentVariables = {});
    boot(string selector) : Promise<App>
}

Methods

constructor(string srcPath, Object environmentVariables = {})

Initializes a Bootstrap object. The srcPath argument specifies a directory path to be used when resolving dependencies. The environmentVariables object are used to determine the current environmental context.

boot(string selector) : Promise<App>

Loads the initial App class, its dependencies, and its configuration (environment.js) and returns a Promise. If the Promise resolves, it will return the application instance.

Examples

Example 1: Booting an EJS application

<script src="path/to/src/ElentraJS/elentrajs.js">
<script>
    let bootstrap = new Bootstrap('path/to/src');
    bootstrap.boot('#app-root');
</script>

Last updated