Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$match: '',
},
account: true,
profile: {
$exact: true,
$children: {
details: true,
},
},
about: {
$query: {
source: true,
},
},
notFound: {
$match: RouteMatch.rest,
},
});
route.account.$beforeEnter(() => {
route.about.$push({source: 'reaction'});
});
route.profile.$beforeEnter(match => {
console.info('before enter profile');
if (match.$exact) {
match.details.$push();
}
});
route.profile.$afterEnter(() => {
$match: '',
},
account: {
$children: {
id: {
$match: RouteMatch.segment,
$extension: {
tick: undefined! as number,
account: undefined! as Account,
},
},
},
},
profile: true,
notFound: {
$match: RouteMatch.rest,
},
});
type AccountIdRouteMatch = typeof route.account.id;
class AccountIdRouteService implements IRouteService {
private timer!: number;
@observable
tick!: number;
constructor(private match: AccountIdRouteMatch) {}
get account(): Account {
let {id} = this.match.$params;
return new Account(id);
const router = new Router(history);
const route = router.$route({
default: {
$match: '',
},
account: true,
profile: true,
about: {
$query: {
source: true,
},
},
notFound: {
$match: RouteMatch.rest,
},
});
@observer
export class App extends Component {
render(): ReactNode {
return (
<>
<h1>Boring Router</h1>
<p>Home page</p>
<div>
Account
</div>
<div>
About</div>
import {BrowserHistory, Link, Route} from '../../bld/library';
const history = new BrowserHistory();
const router = new Router(history);
const route = router.$route({
default: {
$match: '',
},
account: true,
about: true,
revert: true,
notFound: {
$match: RouteMatch.rest,
},
});
route.revert.$beforeEnter(() => false);
@observer
export class App extends Component {
render(): ReactNode {
return (
<>
<h1>Boring Router</h1>
<p>Home page</p>
<div>
Account
</div>
const router = new Router<'popup' | 'sidebar'>(history);
const primaryRoute = router.$route({
default: {
$match: '',
},
news: true,
about: {
$exact: true,
$children: {
test: true,
},
},
contact: true,
notFound: {
$match: RouteMatch.rest,
},
});
const popupRoute = router.$route('popup', {
account: {
$exact: true,
$children: {
login: true,
register: true,
},
},
profile: true,
});
const sidebarRoute = router.$route('sidebar', {
cart: true,