]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * This class provides you with a cross platform way of listening to when the the orientation changes on the\r | |
3 | * device your application is running on.\r | |
4 | *\r | |
5 | * The {@link Ext.device.Orientation#orientationchange orientationchange} event gets passes the `alpha`, `beta` and\r | |
6 | * `gamma` values. ** These properties only exist when packaging with the Sencha Native Packager. **\r | |
7 | *\r | |
8 | * You can find more information about these values and how to use them on the [W3C device orientation specification](http://dev.w3.org/geo/api/spec-source-orientation.html#deviceorientation).\r | |
9 | *\r | |
10 | * ## Example\r | |
11 | *\r | |
12 | * To listen to the device orientation, you can do the following:\r | |
13 | *\r | |
14 | * Ext.device.Orientation.on({\r | |
15 | * scope: this,\r | |
16 | * orientationchange: function(e) {\r | |
17 | * console.log('Alpha: ', e.alpha);\r | |
18 | * console.log('Beta: ', e.beta);\r | |
19 | * console.log('Gamma: ', e.gamma);\r | |
20 | * }\r | |
21 | * });\r | |
22 | *\r | |
23 | * @mixins Ext.device.orientation.Abstract\r | |
24 | */\r | |
25 | Ext.define('Ext.device.Orientation', {\r | |
26 | singleton: true,\r | |
27 | \r | |
28 | requires: [\r | |
29 | 'Ext.device.Communicator',\r | |
30 | 'Ext.device.orientation.HTML5'\r | |
31 | ],\r | |
32 | \r | |
33 | constructor: function() {\r | |
34 | return Ext.create('Ext.device.orientation.HTML5');\r | |
35 | }\r | |
36 | });\r |