diff libervia/web/pages/_browser/tools.py @ 1574:4ab4bc3ae462

browser: new `tools` module with a first method to detect touch devices
author Goffi <goffi@goffi.org>
date Wed, 22 Nov 2023 16:31:36 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libervia/web/pages/_browser/tools.py	Wed Nov 22 16:31:36 2023 +0100
@@ -0,0 +1,6 @@
+"""Common useful tools"""
+from browser import window
+
+
+def is_touch_device():
+    return hasattr(window, 'ontouchstart')