mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +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 patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\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 }\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 }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n"],"mappings":";AAAA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,EAAEC,gB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