1 // ========================================================================== 2 // Project: SproutCore - JavaScript Application Framework 3 // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 // Portions ©2008-2011 Apple Inc. All rights reserved. 5 // License: Licensed under MIT license (see license.js) 6 // ========================================================================== 7 8 SC.mixin(SC.platform, 9 /** @scope SC.platform */ { 10 11 /** 12 YES if the ondeviceorientation event on window is supported. 13 14 @type Boolean 15 @default NO 16 */ 17 supportsGyroscope: ('ondeviceorientation' in window), 18 19 /** 20 YES if the ondeviceorientation event on window has actually been 21 fired. Some platforms have the event but will never fire it. 22 23 @type Boolean 24 @default NO 25 */ 26 hasGyroscope: NO, 27 28 /** 29 YES if the ondevicemotion event on window is supported. 30 31 @type Boolean 32 @default NO 33 */ 34 supportsAccelerometer: ('ondevicemotion' in window), 35 36 /** 37 YES if the ondevicemotion event on window has actually been 38 fired. Some platforms have the event but will never fire it. 39 40 @type Boolean 41 @default NO 42 */ 43 hasAccelerometer: NO, 44 45 /* 46 TODO [CC] Find out the actual values on a multitude of devices. 47 We would want this to be a 'normal' use value... 48 */ 49 /** 50 @type Number 51 @default -10 52 */ 53 accelerationMinimum: function() { 54 // we may want finer grained control of this by platform later 55 return -10; 56 }(), 57 58 /** 59 @type Number 60 @default 10 61 */ 62 accelerationMaximum: function() { 63 // we may want finer grained control of this by platform later 64 return 10; 65 }() 66 67 }); 68