forked from appcelerator-developer-relations/appc-sample-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
60 lines (47 loc) · 1.35 KB
/
index.js
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
/**
* self-executing function to organize otherwise inline constructor code
* @param {Object} args arguments passed to the controller
*/
(function constructor(args) {
// use strict mode for this function scope
'use strict';
if (OS_IOS) {
// open SplitWindow for iPad
if (Alloy.isTablet) {
$.splitWin.open();
// open NavigationWindow for iPhone
} else {
$.navWin.open();
}
// open NavigationGroup's wrapper Window for MobileWeb
} else if (OS_MOBILEWEB) {
$.win.open();
// open master controller's Window view for Android (and other platforms)
} else {
$.masterCtrl.getView().open();
}
// execute constructor with optional arguments passed to controller
})(arguments[0] || {});
/**
* event listener set via view for the select-event of the master controller
* @param {Object} e Event
*/
function onSelect(e) {
'use strict';
// selected model passed with the event
var model = e.model;
// create the detail controller with the model and get its view
var win = Alloy.createController('detail', {
model: model
}).getView();
// open the window in the NavigationWindow for iOS
if (OS_IOS) {
$.navWin.openWindow(win);
// open the window in the NavigationGroup for MobileWeb
} else if (OS_MOBILEWEB) {
$.navWin.open(win);
// simply open the window on top for Android (and other platforms)
} else {
win.open();
}
}