forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui-router-extras.d.ts
151 lines (133 loc) · 4.83 KB
/
ui-router-extras.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Type definitions for UI-Router Extras 0.0.14+ (ct.ui.router.extras module)
// Project: https://github.com/christopherthielen/ui-router-extras
// Definitions by: Michael Putters <https://github.com/mputters/>, Marcel van de Kamp <https://github.com/marcel-k/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
// Support for AMD require
declare module 'angular-ui-router-extras' {
var _: string;
export = _;
}
declare module angular.ui {
/*
* $deepStateRedirect
*/
interface IDeepStateRedirectService {
/*
* This method resets stored $deepStateRedirect data so following transitions will behave like there have not been previous transitions.
* @param stateParams Can be passed in to select specific states to reset:
* {
* 'paramName': 'paramvalue' | ['list', 'of', 'possible', 'paramvalues']
* }
*/
reset(stateName: string, stateParams?: { [key: string]: string | string[] }): void;
}
/*
* Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr
*/
interface IDeepStateRedirectConfig {
/*
* If no deep state has been recorded, DSR will instead redirect to the default substate and params that you specify.
* If default is a string it is interpreted as the substate.
*/
default?: string | IRedirectParams;
/*
* Specify params: true if your DSR state takes parameters.
* If only a subset of the parameters should be included in the parameter grouping for recording deep states,
* specify an array of parameter names.
*/
params?: boolean | string[];
/*
* A callback function that determines whether or not the redirect should actually occur, or changes the redirect to some other state.
* Return an object: IRedirectParams to change the redirect
*/
fn?($dsr$: { redirect: IRedirectParams; to: IRedirectParams }): boolean | IRedirectParams;
}
interface IRedirectParams {
state: string;
params?: ui.IStateParamsService;
}
/*
* Previous state
*/
interface IPreviousState {
state: IState;
params?: ui.IStateParamsService;
}
/**
* Previous state service
*/
interface IPreviousStateService {
/**
* Get a previous state
* @param memoName Memo name
* @return Previous state
*/
get(memoName?: string): IPreviousState;
/**
* Go to a state
* @param memoName Memo name
* @param options State options
* @return Promise
*/
go(memoName: string, options?: IStateOptions): angular.IPromise<any>;
/**
* Memorize a state
* @param memoName Memo name
* @param defaultStateName Default state name
* @param defaultStateParams Default state parameters
*/
memo(memoName: string, defaultStateName?: string, defaultStateParams?: {}): void;
/**
* Forget a memorized name
* @param memoName Memo name
*/
forget(memoName: string): void;
}
/**
* Sticky state
*/
interface IStickyState extends angular.ui.IState {
/*
* When marking a state sticky, the state must target its own unique named ui-view.
* Docs: http://christopherthielen.github.io/ui-router-extras/#/sticky
*/
sticky?: boolean;
/*
* The most-recently-activate substate of the DSR marked state is remembered.
* When the DSR marked state is transitioned to directly, UI-Router Extras will instead redirect to the remembered state and parameters.
* Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr
*/
deepStateRedirect?: boolean | IDeepStateRedirectConfig;
/*
* Shortname deepStateRedirect prop
*/
dsr?: boolean | IDeepStateRedirectConfig;
/*
* Function (injectable). Called when a sticky state is navigated away from (inactivated).
*/
onInactivate?: Function;
/*
* Function (injectable). Called when an inactive sticky state is navigated to (reactivated).
*/
onReactivate?: Function;
/*
* Note: named views are mandatory when using sticky states!
*/
views?: { [name:string]: angular.ui.IState };
}
/**
* Sticky state service
*/
interface IStickyStateService {
getInactiveStates(): IStickyState[];
}
/**
* Sticky state provider
*/
interface IStickyStateProvider extends angular.IServiceProvider {
debugMode(): boolean;
enableDebug(enabled: boolean): boolean;
registerStickyState(state: IStickyState): void;
}
}