]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * @private\r | |
3 | */\r | |
4 | Ext.define('Ext.device.accelerometer.Cordova', {\r | |
5 | alternateClassName: 'Ext.device.accelerometer.PhoneGap',\r | |
6 | extend: 'Ext.device.accelerometer.Abstract',\r | |
7 | activeWatchID: null,\r | |
8 | getCurrentAcceleration: function(config) {\r | |
9 | config = this.callParent(arguments);\r | |
10 | navigator.accelerometer.getCurrentAcceleration(config.success, config.failure);\r | |
11 | return config;\r | |
12 | },\r | |
13 | \r | |
14 | watchAcceleration: function(config) {\r | |
15 | config = this.callParent(arguments);\r | |
16 | if (this.activeWatchID) {\r | |
17 | this.clearWatch();\r | |
18 | }\r | |
19 | this.activeWatchID = navigator.accelerometer.watchAcceleration(config.callback, config.failure, config);\r | |
20 | return config;\r | |
21 | },\r | |
22 | \r | |
23 | clearWatch: function() {\r | |
24 | if (this.activeWatchID) {\r | |
25 | navigator.accelerometer.clearWatch(this.activeWatchID);\r | |
26 | this.activeWatchID = null;\r | |
27 | }\r | |
28 | }\r | |
29 | });\r |