forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe.d.ts
More file actions
225 lines (193 loc) · 8.3 KB
/
frame.d.ts
File metadata and controls
225 lines (193 loc) · 8.3 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/**
* Contains the Frame class, which represents the logical View unit that is responsible for navigation within an application.
*/
declare module "ui/frame" {
import view = require("ui/core/view");
import observable = require("data/observable");
import pages = require("ui/page");
/**
* Represents the logical View unit that is responsible for navigation withing an application.
* Typically an application will have a Frame object at a root level.
* Nested frames are supported, enabling hierarchical navigation scenarios.
*/
export class Frame extends view.View {
/**
* Navigates to the previous entry (if any) in the back stack.
*/
goBack();
/**
* Checks whether the goBack operation is available.
*/
canGoBack(): boolean;
/**
* Navigates to a Page instance as described by the module name.
* This method will require the module and will check for a Page property in the exports of the module.
* @param pageModuleName The name of the module to require starting from the application root.
* For example if you want to navigate to page called "myPage.js" in a folder called "subFolder" and your root folder is "app" you can call navigate method like this:
* var frames = require("ui/frame");
* frames.topmost().navigate("app/subFolder/myPage");
*/
navigate(pageModuleName: string);
/**
* Creates a new Page instance using the provided callback and navigates to that Page.
* @param create The function to be used to create the new Page instance.
*/
navigate(create: () => pages.Page);
/**
* Navigates to a Page resolved by the provided NavigationEntry object.
* Since there are a couple of ways to specify a Page instance through an entry, there is a resolution priority:
* 1. entry.moduleName
* 2. entry.create()
* @param entry The NavigationEntry instance.
*/
navigate(entry: NavigationEntry);
/**
* Gets the back stack of this instance.
*/
backStack: Array<BackstackEntry>;
/**
* Gets the Page instance the Frame is currently navigated to.
*/
currentPage: pages.Page;
/**
* Gets the NavigationEntry instance the Frame is currently navigated to.
*/
currentEntry: NavigationEntry;
/**
* Gets or sets if navigation transitions should be animated.
*/
animated: boolean;
/**
* Gets or sets if navigation transitions should be animated globally.
*/
static defaultAnimatedNavigation: boolean;
/**
* Gets the AndroidFrame object that represents the Android-specific APIs for this Frame. Valid when running on Android OS.
*/
android: AndroidFrame;
/**
* Gets the iOSFrame object that represents the iOS-specific APIs for this Frame. Valid when running on iOS.
*/
ios: iOSFrame;
//@private
_processNavigationQueue(page: pages.Page);
//@endprivate
}
/**
* Gets the topmost frame in the frames stack. An application will typically has one frame instance. Multiple frames handle nested (hierarchical) navigation scenarios.
*/
export function topmost(): Frame;
/**
* Navigates back using the navigation hierarchy (if any). Updates the Frame stack as needed.
* This method will start from the topmost Frame and will recursively search for an instance that has the canGoBack operation available.
*/
export function goBack();
/**
* Gets the frames stack.
*/
export function stack(): Array<Frame>;
/**
* Represents an entry in passed to navigate method.
*/
export interface NavigationEntry {
/**
* The name of the module containing the Page instance to load. Optional.
*/
moduleName?: string;
/**
* A function used to create the Page instance. Optional.
*/
create?: () => pages.Page;
/**
* An object passed to the onNavigatedTo callback of the Page. Typically this is used to pass some data among pages. Optional.
*/
context?: any;
/**
* True to navigate to the new Page using animated transitions, false otherwise.
*/
animated?: boolean;
}
/**
* Represents an entry in the back stack of a Frame object.
*/
export interface BackstackEntry {
entry: NavigationEntry;
resolvedPage: pages.Page;
}
/**
* Represents the data passed to the knownEvents.android.optionSelected event.
* This event is raised by the Android OS when an option in the Activity's action bar has been selected.
*/
export interface AndroidOptionEventData extends observable.EventData {
/**
* Gets the Android-specific menu item that has been selected.
*/
item: android.view.MenuItem;
/**
* True to mark the event as handled (that is to prevent the default processing).
*/
handled: boolean;
}
/**
* Represents the Android-specific Frame object, aggregated within the common Frame one.
* In Android there are two types of navigation - using new Activity instances or using Fragments within the main Activity.
* To start a new Activity, a new Frame instance should be created and navigated to the desired Page.
*/
export interface AndroidFrame extends observable.Observable {
/**
* Gets the native [android ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html) instance that represents the root layout part of the Frame.
*/
rootViewGroup: android.view.ViewGroup;
/**
* Gets the native [android Activity](http://developer.android.com/reference/android/app/Activity.html) instance associated with this Frame. In case of nested Frame objects, this property points to the activity of the root Frame.
*/
activity: android.app.Activity;
/**
* Gets the current (foreground) activity for the application. This property will recursively traverse all existing Frame objects and check for own Activity property.
*/
currentActivity: android.app.Activity;
/**
* Gets the actionBar property of the currentActivity.
*/
actionBar: android.app.ActionBar;
/**
* A function called by the Runtime whenever a new Activity is about to be opened.
* @param intent The native [android Intent](http://developer.android.com/reference/android/content/Intent.html) object passed to the Activity's onCreate method.
*/
onActivityRequested(intent: android.content.Intent): Object;
/**
* Determines whether the Activity associated with this Frame will display an action bar or not.
*/
showActionBar: boolean;
/**
* Gets or sets whether the page UI will be cached when navigating away from the page.
*/
cachePagesOnNavigate: boolean;
}
/* tslint:disable */
/**
* Represents the iOS-specific Frame object, aggregated within the common Frame one.
* In iOS the native controller, associated with a Frame object is UINavigationController.
* The navigation controller will automatically hide/show its navigation bar depending on the back stack of the Frame.
*/
export interface iOSFrame {
/**
* Gets the native [UINavigationController](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UINavigationController_Class/index.html) instance associated with this Frame.
*/
controller: UINavigationController;
}
/**
* Encapsulates the events raised by the Frame object.
*/
module knownEvents {
/**
* Encapsulates the events raised by the android part of the Frame.
*/
module android {
/**
* Raised when the native [onOptionsItemSelected method](http://developer.android.com/reference/android/app/Activity.html#onOptionsItemSelected(android.view.MenuItem)) is called.
*/
export var optionSelected: string;
}
}
}