mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
1 line
6.8 KiB
JSON
1 line
6.8 KiB
JSON
|
|
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n impact(options) {\n var _this = this;\n return _asyncToGenerator(function* () {\n const pattern = _this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n _this.vibrateWithPattern(pattern);\n })();\n }\n notification(options) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n const pattern = _this2.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n _this2.vibrateWithPattern(pattern);\n })();\n }\n vibrate(options) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n _this3.vibrateWithPattern([duration]);\n })();\n }\n selectionStart() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n _this4.selectionStarted = true;\n })();\n }\n selectionChanged() {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n if (_this5.selectionStarted) {\n _this5.vibrateWithPattern([70]);\n }\n })();\n }\n selectionEnd() {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n _this6.selectionStarted = false;\n })();\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n } else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n } else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n } else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}","map":{"version":3,"names":["WebPlugin","ImpactStyle","NotificationType","HapticsWeb","constructor","arguments","selectionStarted","impact","options","_this","_asyncToGenerator","pattern","patternForImpact","style","vibrateWithPattern","notification","_this2","patternForNotification","type","vibrate","_this3","duration","selectionStart","_this4","selectionChanged","_this5","selectionEnd","_this6","Heavy","Medium","Light","Success","Warning","Error","navigator","unavailable"],"sources":["C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@capacitor/haptics/dist/esm/web.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n
|