Hello,
I’m quite new working with aurelia and searching for a good tutorial for developing aurelia-plugins.
Currently I have the aurelia-skeleton-plugin and want to create an own plugin that get use of the “aurelia-configuration” plugin.
Trying to develop that plugin I have following questions:
- How can I get an configured instance of
AureliaConfiguration
within my plugin class? - How can I configure my plugin within the index.ts? (Beside my index.ts I have my main class “RouteService” that includes all the business logic. This class needs to get the aurelia-Configuration-Instance)
Having a look into the AureliaConfiguration-Plugin I would setup my index.ts as follows:
import { FrameworkConfiguration } from 'aurelia-framework';
import { RouteService} from './RouteService';
export function configure(aurelia: FrameworkConfiguration, configCallback?: (config: AureliaConfiguration) => Promise<any>) {
let instance = aurelia.container.get(RouteService) as RouteService;
let promise: Promise<any> | null = null;
// Do we have a callback function?
if (configCallback !== undefined && typeof (configCallback) === 'function') {
promise = Promise.resolve(configCallback(instance));
} else {
promise = Promise.resolve();
}
// Don't load the config until the configCallback has completed.
return promise
.then(function () {
return instance.loadConfig();
});
}
export { RouteService};
But how to pass the already configured AureliaConfiguration-Instance into my RouteService?
Is there a good tutorial?