-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
MainView.ux
executable file
·61 lines (48 loc) · 1.59 KB
/
MainView.ux
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
<App>
<DockPanel>
<StatusBarBackground Dock="Top" />
<BottomBarBackground Dock="Bottom" />
<JavaScript>
var Observable = require("FuseJS/Observable");
var GeoLocation = require("FuseJS/GeoLocation");
// Immediate
var immediateLocation = JSON.stringify(GeoLocation.location);
// Timeout
var timeoutLocation = Observable("");
var timeoutMs = 5000;
GeoLocation.getLocation(timeoutMs).then(function(location) {
timeoutLocation.value = JSON.stringify(location);
});
// Continuous
var continuousLocation = Observable("");
GeoLocation.onChanged = function(location) {
continuousLocation.value = JSON.stringify(location);
};
function startContinuousListener() {
var intervalMs = 1000;
var desiredAccuracyInMeters = 10;
GeoLocation.startListening(intervalMs, desiredAccuracyInMeters);
}
function stopContinuousListener() {
GeoLocation.stopListening();
}
module.exports = {
immediateLocation: immediateLocation,
timeoutLocation: timeoutLocation,
continuousLocation: continuousLocation,
startContinuousListener: startContinuousListener,
stopContinuousListener: stopContinuousListener
};
</JavaScript>
<StackPanel>
<Text>Immediate:</Text>
<Text Value="{immediateLocation}" />
<Text>Timeout:</Text>
<Text Value="{timeoutLocation}" />
<Text>Continuous:</Text>
<Text Value="{continuousLocation}" />
<Button Text="Start continuous listener" Clicked="{startContinuousListener}" />
<Button Text="Stop continuous listener" Clicked="{stopContinuousListener}" />
</StackPanel>
</DockPanel>
</App>