/
ExponentDeviceMotion.web.js.map
1 lines (1 loc) · 2.1 KB
/
ExponentDeviceMotion.web.js.map
1
{"version":3,"file":"ExponentDeviceMotion.web.js","sourceRoot":"","sources":["../src/ExponentDeviceMotion.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,eAAe;IACb,IAAI,IAAI;QACN,OAAO,sBAAsB,CAAC;IAChC,CAAC;IACD;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,IAAI,OAAO,iBAAiB,KAAK,WAAW,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QACD,OAAO,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IACD,aAAa,CAAC,MAAM;QAClB,2CAA2C;QAC3C,wBAAwB,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACrD,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,4BAA4B,EAAE,MAAM,CAAC,4BAA4B;YACjE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC;IACL,CAAC;IACD,cAAc;QACZ,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzD,CAAC;IACD,aAAa;QACX,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC","sourcesContent":["import { SyntheticPlatformEmitter } from '@unimodules/core';\n\nimport { isSensorEnabledAsync } from './utils/isSensorEnabledAsync.web';\n\nconst eventName = 'devicemotion';\n\nexport default {\n get name(): string {\n return 'ExponentDeviceMotion';\n },\n /**\n * Gravity on the planet this module supports (currently just Earth) represented as m/s^2.\n */\n get Gravity(): number {\n return 9.80665;\n },\n async isAvailableAsync(): Promise<boolean> {\n if (typeof DeviceMotionEvent === 'undefined') {\n return false;\n }\n return await isSensorEnabledAsync(eventName);\n },\n _handleMotion(motion) {\n // TODO: Bacon: Can rotation be calculated?\n SyntheticPlatformEmitter.emit('deviceMotionDidUpdate', {\n acceleration: motion.acceleration,\n accelerationIncludingGravity: motion.accelerationIncludingGravity,\n interval: motion.interval,\n rotationRate: motion.rotationRate,\n orientation: window.orientation,\n });\n },\n startObserving() {\n window.addEventListener(eventName, this._handleMotion);\n },\n stopObserving() {\n window.removeEventListener(eventName, this._handleMotion);\n },\n};\n"]}