-
Notifications
You must be signed in to change notification settings - Fork 0
TypeScript
Jagwah provides a few Typescript specific things such as Decorators and Modules / Interfaces.
The @Provider
decorator can be used to set the static $provider
property used by Providers.
import { Provider } from 'jagwah';
β
@Provider('$notif')
export class NotificationProvider {
constructor() {}
}
The @Template
decorator can be used to set the static $template
and optionally the $selector
property used by Templates.
import { Template } from 'jagwah';
β
@Template('notifications', '#notifications')
export class NotificationsTemplate {
constructor() {}
}
The @Templates
decorator can be used to set the static $templates
property used by Routes.
import { Templates } from 'jagwah';
β
@Templates([AccountTemplate])
export class AccountRoute {
constructor() {}
}
The @Inject
decorator can be used to set and append the static $inject
property used by Providers, Templates, Routes, Middleware and more.
import { Provider } from 'jagwah';
β
export class AccountProvider {
constructor(
@Inject('$notif') private $notif: NotificationProvider
) {}
}
The @Selector
decorator can be used to set the static $selector
property used by Templates.
import { Selector } from 'jagwah';
β
@Selector('#navigation')
export class NavigationTemplate {
constructor() {}
}
The @Route
decorator can be used to set the static $route
property used by Routes.
import { Route } from 'jagwah';
β
@Route('/user/:id')
export class UserProfileRoute {
constructor() {}
}
The @Middleware
decorator can be used to set the static $before
and $after
properties used by Routes.
import { Route, Middleware } from 'jagwah';
β
@Route('/account')
@Middleware('before', [new SignedInMiddleware('/account/sign/in')])
export class AccountRoute {
constructor() {}
}