UNPKG

@ionic/core

Version:
4 lines • 1.09 kB
/*! * (C) Ionic http://ionicframework.com - MIT License */ import{g as t}from"./p-CIGNaXM1.js";var s,n;!function(t){t.Heavy="HEAVY",t.Medium="MEDIUM",t.Light="LIGHT"}(s||(s={})),function(t){t.Success="SUCCESS",t.Warning="WARNING",t.Error="ERROR"}(n||(n={}));const i={getEngine(){const s=t();if(s?.isPluginAvailable("Haptics"))return s.Plugins.Haptics},available(){if(!this.getEngine())return!1;const s=t();return"web"!==s?.getPlatform()||"undefined"!=typeof navigator&&void 0!==navigator.vibrate},impact(t){const s=this.getEngine();s&&s.impact({style:t.style})},notification(t){const s=this.getEngine();s&&s.notification({type:t.type})},selection(){this.impact({style:s.Light})},selectionStart(){const t=this.getEngine();t&&t.selectionStart()},selectionChanged(){const t=this.getEngine();t&&t.selectionChanged()},selectionEnd(){const t=this.getEngine();t&&t.selectionEnd()}},e=()=>i.available(),o=()=>{e()&&i.selection()},a=()=>{e()&&i.selectionStart()},c=()=>{e()&&i.selectionChanged()},r=()=>{e()&&i.selectionEnd()},h=t=>{e()&&i.impact(t)};export{s as I,c as a,a as b,h as c,o as d,r as h}