2021-04-14 17:47:26 +02:00
|
|
|
class TouchScreenManager {
|
2021-09-06 14:27:54 +02:00
|
|
|
readonly supportTouchScreen: boolean;
|
|
|
|
|
2021-04-14 17:47:26 +02:00
|
|
|
constructor() {
|
|
|
|
this.supportTouchScreen = this.detectTouchscreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
//found here: https://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript#4819886
|
|
|
|
detectTouchscreen(): boolean {
|
2021-09-06 14:27:54 +02:00
|
|
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
2021-04-14 17:47:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-06 14:27:54 +02:00
|
|
|
export const touchScreenManager = new TouchScreenManager();
|