SShortSingh.
Back to feed

Pointer Events: One API for Mouse, Touch and Pen Input

0
·5 views

Previously, developers had to write separate logic for mouse, touch, and pen input, each with its own quirks. Pointer Events merge these into a single set of events, including pointerdown, pointermove, pointerup, and pointercancel, regardless of the input device. The pointerType property identifies the source device, allowing special handling when needed. Using setPointerCapture() keeps drag interactions reliable even when the pointer leaves an element, and touch-action: none in CSS stops browser gestures from interfering. The pressure property also lets apps such as drawing tools vary stroke width using the same handlers.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Lithuania has three different calendars for working days, settlement days and exchange sessions

A Python package called aion-lithuanian-market-calendar, released under the MIT licence, answers whether a date is a Lithuanian business day, a TARGET euro settlement day, or a Nasdaq Vilnius trading day. The article shows that these three calendars disagree on several dates, such as Good Friday 2026, Christmas Eve, and New Year's Eve. The author notes that general calendar packages already cover Nasdaq Vilnius sessions, but only this package also covers business days and TARGET settlement days. The package also provides bilingual holiday names, business-day arithmetic, and coverage of 19 European venues. Exchange closures come from published data checked against a hash manifest, and unannounced national mourning days are out of scope.

0
ProgrammingDEV Community ·

How JavaScript Proxy and Reflect let you intercept object operations

JavaScript's Proxy wraps an object so developers can intercept actions such as reading, setting, or deleting properties, and Reflect provides companion methods that perform the default behaviour. Together they underpin reactivity in frameworks like Vue. A handler defines traps such as get and set that run on each read or write, which makes them useful for logging and for watching changes. A common use is validation, where a set trap rejects invalid values such as negative ages at the moment of assignment. The article advises using proxies only where interception is worthwhile, since they add overhead to every operation on the wrapped object.

0
ProgrammingDEV Community ·

Adding Redis Cache Slowed a URL Shortener Due to Regional Latency Mismatch

A developer added Redis caching to their Node.js URL shortener, expecting faster redirects by skipping PostgreSQL queries on cache hits. Benchmarking with k6 instead showed the Redis-enabled version was significantly slower, with average latency rising from about 87 ms to roughly 139 ms. The developer's stack spans Vercel, Render, Neon, and Upstash, and the investigation pointed to a Redis round trip of around 65 ms as a key factor. The article attributes the slowdown largely to a regional mismatch between the services, which added network overhead that outweighed the savings from avoiding database lookups.

0
ProgrammingDEV Community ·

Open Mark Six lottery dataset and free API released with 3,266 Macau and Hong Kong draws

A developer has published an open dataset covering 3,266 historical Mark Six lottery draw records from Macau and Hong Kong. The Macau portion holds 2,454 draws since March 2020 and is updated after each draw, while the Hong Kong portion includes 812 draws. Each entry lists the issue number, draw date, six main numbers, special number, and derived fields such as zodiac, wave color, and five elements. The data is available as CSV and JSON under a CC BY 4.0 license, alongside a free, keyless JSON API offering latest results, paginated history, and frequency statistics.