changeset 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 02432346e9b2
children 9e3f7bf55749
files libervia/web/pages/_browser/tools.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
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')