import { OnDestroy, Injector } from '@angular/core'; import { ActivatedRouteSnapshot } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { MenuService } from '@delon/theme'; import { ReuseTabCached, ReuseTabMatchMode, ReuseTabNotify } from './interface'; export declare class ReuseTabService implements OnDestroy { private injector; private menuService; private _max; private _debug; private _mode; private _excludes; private _cachedChange; private _cached; private _titleCached; private _hookCached; private removeBuffer; private curUrl; /** 允许最多复用多少个页面,取值范围 `2-100` */ max: number; /** 设置匹配模式 */ mode: ReuseTabMatchMode; /** 设置Debug模式 */ debug: boolean; /** 排除规则,限 `mode=URL` */ excludes: RegExp[]; /** 获取指定路径缓存所在位置,`-1` 表示无缓存 */ index(rawUrl: string): number; /** 获取指定路径缓存是否存在 */ exists(url: string): boolean; /** 获取指定路径缓存 */ get(path: string): ReuseTabCached; private destroy(_handle); private di(...args); /** * 根据URL移除标签 */ remove(url: string): void; /** * 移除指定路径缓存 * @private */ _remove(data: any): boolean; /** * 清除所有缓存 */ clear(): void; /** * 清除标题缓存 */ clearTitleCached(): void; /** 获取已缓存的路由 */ readonly items: ReuseTabCached[]; /** 获取当前缓存的路由总数 */ readonly count: number; /** 订阅缓存变更通知 */ readonly change: Observable; /** 设置当前页标题 */ title: string; /** @private */ _clearRemoveBuffer(): void; constructor(injector: Injector, menuService: MenuService); /** @private */ getTitle(url: string, route?: ActivatedRouteSnapshot): string; getTruthRoute(route: ActivatedRouteSnapshot): ActivatedRouteSnapshot; getUrl(route: ActivatedRouteSnapshot): string; getRawUrl(route: any): string; private getMenu(url); private runHook(method, url, comp); /** @private */ getClosable(url: string, route?: ActivatedRouteSnapshot): boolean; /** * 判断路由是否可以复用 * @param {ActivatedRouteSnapshot} route * @returns {boolean} */ can(route: ActivatedRouteSnapshot): boolean; /** * 决定是否允许路由复用,若 `true` 会触发 `store` * Determines if this route (and its subtree) should be detached to be reused later */ shouldDetach(route: ActivatedRouteSnapshot): boolean; /** * Stores the detached route. * * Storing a `null` value should erase the previously stored value. */ store(_snapshot: ActivatedRouteSnapshot, _handle: any): void; /** * 决定是否允许应用缓存数据 * Determines if this route (and its subtree) should be reattached */ shouldAttach(route: ActivatedRouteSnapshot): boolean; /** * 提取复用数据 * Retrieves the previously stored route */ retrieve(route: ActivatedRouteSnapshot): {}; /** * 决定是否应该进行复用路由处理 * Determines if a route should be reused */ shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean; ngOnDestroy(): void; }