-
Notifications
You must be signed in to change notification settings - Fork 0
/
jslib.js
53 lines (51 loc) · 1.24 KB
/
jslib.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
/**
* Script-side utility library
* @namespace
* @toplevel
*/
var nglib = {};
/**
* Abstract base class for custom pages, wrapping {@link ng.view.Page}. Used for
* the ability to use `this` in `onNext` / `onBack`.
* @class
* @abstract
* @param {string} pageTitle
* @toplevel
*/
nglib.PageController = function(pageTitle) {
var o = this;
this.view = ng.window.createPage(pageTitle);
this.view.onNext = function() {
if ('onNext' in o) return o.onNext();
};
this.view.onBack = function() {
if ('onBack' in o) return o.onBack();
};
};
/**
* Push underlying page onto wizard stack.
*/
nglib.PageController.prototype.push = function() {
ng.window.pushPage(this.view);
};
/**
* Wrapper for {@link ng.view.Page#onNext}. Override this in subclasses.
* @method onNext
* @memberof nglib.PageController
* @instance
* @abstract
*/
/**
* Wrapper for {@link ng.view.Page#onBack}. Override this in subclasses.
* @method onBack
* @memberof nglib.PageController
* @instance
* @abstract
*/
/**
* Are we running in Steam Play? (Proton, Steam's Linux Wine wrapper)
*/
nglib.isSteamPlay = function() {
if (!ng.systemInfo.isWine()) return false;
return ng.systemInfo.getEnv('HOMEPATH').indexOf('steamuser') !== -1;
}