UNPKG

3.78 kBTypeScriptView Raw
1import { UrlMatcherFactory } from './url/urlMatcherFactory';
2import { UrlRouter } from './url/urlRouter';
3import { TransitionService } from './transition/transitionService';
4import { ViewService } from './view/view';
5import { StateRegistry } from './state/stateRegistry';
6import { StateService } from './state/stateService';
7import { UIRouterGlobals } from './globals';
8import { UIRouterPlugin, Disposable } from './interface';
9import { UrlService } from './url/urlService';
10import { LocationServices, LocationConfig } from './common/coreservices';
11import { Trace } from './common/trace';
12/**
13 * An instance of UI-Router.
14 *
15 * This object contains references to service APIs which define your application's routing behavior.
16 */
17export declare class UIRouter {
18 locationService: LocationServices;
19 locationConfig: LocationConfig;
20 /** @internal */ $id: number;
21 /** @internal */ _disposed: boolean;
22 /** @internal */ private _disposables;
23 /** Enable/disable tracing to the javascript console */
24 trace: Trace;
25 /** Provides services related to ui-view synchronization */
26 viewService: ViewService;
27 /** An object that contains global router state, such as the current state and params */
28 globals: UIRouterGlobals;
29 /** A service that exposes global Transition Hooks */
30 transitionService: TransitionService;
31 /**
32 * Deprecated for public use. Use [[urlService]] instead.
33 * @deprecated Use [[urlService]] instead
34 */
35 urlMatcherFactory: UrlMatcherFactory;
36 /**
37 * Deprecated for public use. Use [[urlService]] instead.
38 * @deprecated Use [[urlService]] instead
39 */
40 urlRouter: UrlRouter;
41 /** Provides services related to the URL */
42 urlService: UrlService;
43 /** Provides a registry for states, and related registration services */
44 stateRegistry: StateRegistry;
45 /** Provides services related to states */
46 stateService: StateService;
47 /** @internal plugin instances are registered here */
48 private _plugins;
49 /** Registers an object to be notified when the router is disposed */
50 disposable(disposable: Disposable): void;
51 /**
52 * Disposes this router instance
53 *
54 * When called, clears resources retained by the router by calling `dispose(this)` on all
55 * registered [[disposable]] objects.
56 *
57 * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.
58 *
59 * @internal
60 * @param disposable (optional) the disposable to dispose
61 */
62 dispose(disposable?: any): void;
63 /**
64 * Creates a new `UIRouter` object
65 *
66 * @param locationService a [[LocationServices]] implementation
67 * @param locationConfig a [[LocationConfig]] implementation
68 * @internal
69 */
70 constructor(locationService?: LocationServices, locationConfig?: LocationConfig);
71 /** Add plugin (as ES6 class) */
72 plugin<T extends UIRouterPlugin>(plugin: {
73 new (router: UIRouter, options?: any): T;
74 }, options?: any): T;
75 /** Add plugin (as javascript constructor function) */
76 plugin<T extends UIRouterPlugin>(plugin: {
77 (router: UIRouter, options?: any): void;
78 }, options?: any): T;
79 /** Add plugin (as javascript factory function) */
80 plugin<T extends UIRouterPlugin>(plugin: PluginFactory<T>, options?: any): T;
81 /**
82 * Returns a plugin registered with the given `pluginName`.
83 *
84 * @param pluginName the name of the plugin to get
85 * @return the plugin, or undefined
86 */
87 getPlugin(pluginName: string): UIRouterPlugin;
88 /**
89 * Returns all registered plugins
90 * @return all registered plugins
91 */
92 getPlugin(): UIRouterPlugin[];
93}
94/** @internal */
95export declare type PluginFactory<T> = (router: UIRouter, options?: any) => T;