{"version":3,"file":"./modules/DetectDevice.xxxxxxxx.js","mappings":"8IAGe,MAAMA,EAIjB,WAAAC,GACKC,OAAOC,WAAa,CACjB,SAAwC,aAA5BC,KAAKC,mBACjB,SAAwC,aAA5BD,KAAKC,mBACjB,UAAyC,cAA5BD,KAAKC,oBAGtBD,KAAKE,oBACT,CAEQ,kBAAAA,GAEJ,OADAJ,OAAOK,gBAAgB,UAAU,KAAM,QAASH,KAAKC,mBAAoB,MAAMG,QACxEJ,IACX,CAEQ,gBAAAC,GAKJ,OAJAD,KAAKK,kBAAoBD,OAAOE,WAAa,IAAM,WAC/CF,OAAOE,YAAc,KAAOF,OAAOE,WAAa,KAAO,WACnD,YACRN,KAAKO,uBACEP,KAAKK,iBAChB,CAEQ,oBAAAE,GAUJ,OATIP,KAAKQ,oBAAsBR,KAAKQ,qBAAuBR,KAAKK,oBAC5DP,OAAOC,WAAa,CAChB,SAAuC,aAA3BC,KAAKK,kBACjB,SAAuC,aAA3BL,KAAKK,kBACjB,UAAwC,cAA3BL,KAAKK,mBAEtBI,SAASC,cAAc,IAAIC,YAAY,0BAA2B,CAAEC,OAAQ,CAAEb,WAAYC,KAAKK,uBAEnGL,KAAKQ,mBAAqBR,KAAKK,kBACxBL,IACX,E","sources":["webpack:///./DetectDevice.ts"],"sourcesContent":["/// \r\nimport { debounce } from './helpers/helperFunctions';\r\n\r\nexport default class DetectDevice {\r\n previousDeviceType: string;\r\n currentDeviceType: string;\r\n\r\n constructor() {\r\n NiveaX.deviceType = {\r\n 'isMobile': this.detectDeviceSize() === 'isMobile',\r\n 'isTablet': this.detectDeviceSize() === 'isTablet',\r\n 'isDesktop': this.detectDeviceSize() === 'isDesktop',\r\n };\r\n\r\n this.onBreakpointChange();\r\n }\r\n\r\n private onBreakpointChange(): DetectDevice {\r\n NiveaX.addToEventStore('resize', () => debounce(this.detectDeviceSize(), 300), window);\r\n return this;\r\n }\r\n\r\n private detectDeviceSize(): string {\r\n this.currentDeviceType = window.innerWidth < 768 ? \"isMobile\" :\r\n window.innerWidth >= 768 && window.innerWidth < 1024 ? \"isTablet\" :\r\n \"isDesktop\";\r\n this.checkBreakpoinChange();\r\n return this.currentDeviceType;\r\n }\r\n\r\n private checkBreakpoinChange(): DetectDevice {\r\n if (this.previousDeviceType && this.previousDeviceType !== this.currentDeviceType) {\r\n NiveaX.deviceType = {\r\n 'isMobile': this.currentDeviceType === 'isMobile',\r\n 'isTablet': this.currentDeviceType === 'isTablet',\r\n 'isDesktop': this.currentDeviceType === 'isDesktop',\r\n };\r\n document.dispatchEvent(new CustomEvent('niveax:breakpointchange', { detail: { deviceType: this.currentDeviceType } }));\r\n }\r\n this.previousDeviceType = this.currentDeviceType;\r\n return this;\r\n }\r\n}"],"names":["DetectDevice","constructor","NiveaX","deviceType","this","detectDeviceSize","onBreakpointChange","addToEventStore","window","currentDeviceType","innerWidth","checkBreakpoinChange","previousDeviceType","document","dispatchEvent","CustomEvent","detail"],"sourceRoot":""}