import { RouteMatchManager , RouteMatcher } from '../route' ; class RouteAPI { private readonly router : RouteMatchManager ; private current : RouteMatcher ; constructor ( matched , router ) { this . current = matched ; this . router = router ; } public cur ( ) { return this . current . generate ( ) ; } public get ( entryName ) { const { router } = this ; const matched = router . matchEntry ( entryName ) ; return matched ? matched . generate ( ) : null ; } public use ( entryName ) { const { router } = this ; const matched = router . matchEntry ( entryName ) ; if ( matched ) { this . current = matched ; return true ; } else { return false ; } } } export const createRouteAPI = ( matched , router ) => new RouteAPI ( matched , router ) ;