main.js

Plasma launching

the main.js file will load plasma inside your index.html file

import routes from "./src/config/routes";
import Plasma from "./src/Plasma/Plasma";
import CustomAuthenticator from "./src/security/CustomAuthenticator";
import LangManager from "./src/utils/LangManager";

As you see these first lines are imports :

  • routes : this is the routes we have created before

  • Plasma : this is the core file of Plasma

  • CustomAuthenticator : we'll see it later

  • LangManager : is the manager in charge of translate

Once imports are done we use jQuery to wait till document is ready, then we initialize our plasma instance

$(document).ready(() => {
    window.PLASMA = new Plasma(config, routes.getRoutes())
    PLASMA.registerAuthenticator(new CustomAuthenticator())
    PLASMA.registerLangManager(LangManager)
    PLASMA.init()
})pt

You'll see how to use CustomAuthenticator in the next section.

Last updated