I know aurelia is convention oriented, but are there more interfaces hiding somewhere? example, I have this
@connectTo()
@autoinject()
export class App {
constructor(
private router: Router,
private readonly store: Store<State>,
private readonly stateHolder: StateHolder,
) {
}
configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'WarMeister';
config.map([
{
route: ['', 'home'],
name: 'home',
viewPorts: {
main: { moduleId: PLATFORM.moduleName('roster/GameRosterNav') },
},
},
{
route: 'games',
name: 'games',
title: 'Add Game',
viewPorts: {
main: { moduleId: PLATFORM.moduleName('game/index') },
}
},
// { route: ':user/rosters/:game', name: 'rosters', moduleId: PLATFORM.moduleName('roster/GameRosterNav'), title: 'Roster' },
]);
this.router = router;
}
async attached() {
return this.store.state.subscribe((state) => {
console.log('state', state);
this.stateHolder.state = state;
});
}
but what I’d really like is
@connectTo()
@autoinject()
export class App implements RouterConfigurer, AttachListener {
constructor(
private router: Router,
private readonly store: Store<State>,
private readonly stateHolder: StateHolder,
) {
}
configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'WarMeister';
config.addRoutes([ // currently .map is very week, and doesn't really say which keys are available and typos are very easy.
{
route: ['', 'home'],
name: 'home',
viewPorts: {
main: { moduleId: PLATFORM.moduleName('roster/GameRosterNav') },
},
},
{
route: 'games',
name: 'games',
title: 'Add Game',
viewPorts: {
main: { moduleId: PLATFORM.moduleName('game/index') },
}
},
// { route: ':user/rosters/:game', name: 'rosters', moduleId: PLATFORM.moduleName('roster/GameRosterNav'), title: 'Roster' },
]);
this.router = router;
}
async attached() {
return this.store.state.subscribe((state) => {
console.log('state', state);
this.stateHolder.state = state;
});
}
is this already possible? should I open a bug requesting for v2? would v1 backport patches be welcome?