Loading a xml file once

well with aurelia you can access the DI container and pretty much register whatever you want

export class MyGlobalContainer {
  ...
}
import { MyGlobalContainer } from "./my-global-container";

export function configure(aurelia) {
      aurelia.use
        .standardConfiguration()
        .developmentLogging();


       // yourAsyncJobToReadTheXMLFile creates a new MyGlobalContainer containing the parsed info from your xml and resolves the promise with the instance
       yourAsyncJobToReadTheXMLFile().then((containerInstance) => {
          // see docshttps://aurelia.io/docs/fundamentals/dependency-injection#how-aurelia-uses-containers
         aurelia.container.registerInstance(MyGlobalContainer, containerInstance);

        aurelia.start().then(() => aurelia.setRoot());
      });
    }
1 Like