惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
L
LINUX DO - 热门话题
Engineering at Meta
Engineering at Meta
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
Attack and Defense Labs
Attack and Defense Labs
P
Privacy & Cybersecurity Law Blog
V
Visual Studio Blog
NISL@THU
NISL@THU
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
SecWiki News
SecWiki News
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threatpost
TaoSecurity Blog
TaoSecurity Blog
L
LINUX DO - 最新话题
量子位
Security Latest
Security Latest
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
Intezer
P
Privacy International News Feed
P
Palo Alto Networks Blog
爱范儿
爱范儿
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Cloudbric
Cloudbric
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
美团技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
博客园_首页
博客园 - 聂微东
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Securelist
Spread Privacy
Spread Privacy
小众软件
小众软件
PCI Perspectives
PCI Perspectives
T
Troy Hunt's Blog

oida.dev | TypeScript, Rust

TypeScript's `erasableSyntaxOnly` Flag Unsafe for work Tokio: Macros Tokio: Channels Tokio: Getting Started Network Applications on the Tokio Stack Remake, Remodel, Reduce. The `never` type and error handling in TypeScript 5 Inconvenient Truths about TypeScript Refactoring in Rust: Introducing Traits Refactoring in Rust: Abstraction with the Newtype Pattern Announcing the TypeScript Cookbook TypeScript: Iterating over objects The road to universal JavaScript 10 years of oida.dev Rust: Tiny little traits The TypeScript converging point How not to learn TypeScript Getting started with Rust Introducing Slides and Coverage TypeScript: The humble function overload TypeScript + React: Children types are broken TypeScript: In defense of any Rust: Enums to wrap multiple errors Dissecting Deno Error handling in Rust TypeScript: Unexpected intersections Upgrading Node.js dependencies after a yarn audit TypeScript: Array.includes on narrow types TypeScript + React: Typing Generic forwardRefs shared, util, core: Schroedinger's module names Learning Rust and Go TypeScript: Narrow types in catch clauses TypeScript: Low maintenance types Tidy TypeScript: Name your generics Tidy TypeScript: Avoid traditional OOP patterns Tidy TypeScript: Prefer type aliases over interfaces Tidy TypeScript: Prefer union types over enums My new book: TypeScript in 50 Lessons Go Preact! ❤️ this in JavaScript and TypeScript TypeScript and ECMAScript Modules TypeScript + React: Why I don't use React.FC TypeScript + React: Component patterns TypeScript: Augmenting global and lib.dom.d.ts Vite with Preact and TypeScript TypeScript: Union to intersection type 11ty: Generate Twitter cards automatically Are large node module dependencies an issue? TypeScript: Variadic Tuple Types Preview TypeScript: Improving Object.keys Remake, Remodel. Part 4. TypeScript + React: Typing custom hooks with tuple types TypeScript: Assertion signatures and Object.defineProperty TypeScript: Check for object properties and narrow down type Boolean in JavaScript and TypeScript void in JavaScript and TypeScript Symbols in JavaScript and TypeScript Why I use TypeScript TypeScript + React: Extending JSX Elements TypeScript: Validate mapped types and const context TypeScript: Match the exact object shape TypeScript: The constructor interface pattern Streaming your Meetup - Part 4: Directing and Streaming with OBS Streaming your Meetup - Part 3: Speaker audio Streaming your Meetup - Part 2: Speaker video Streaming your Meetup - Part 1: Basics and Projector TypeScript and React Guide: Added a new styles chapter TypeScript and React Guide: Added a new render props chapter TypeScript and React: Styles and CSS TypeScript and React TypeScript and React Guide: Added a new prop types chapter TypeScript without TypeScript -- JSDoc superpowers TypeScript: Mapped types for type maps JAMStack vs serverless web apps The Unsung Benefits of JAMStack Sites TypeScript: Ambient modules for Webpack loaders My most favourite talks in 2018 TypeScript and React Guide: Added a new context chapter TypeScript: Built-in generic types TypeScript: Type predicates JSX is syntactic sugar TypeScript and React Guide: Added a new hooks chapter Getting your CfP application right FAQ on our Angular Connect Talk: Automating UI development TypeScript and Substitutability Debugging Node.js apps in TypeScript with Visual Studio Code From Medium: Deconfusing Pre- and Post-processing From Medium: PostCSS misconceptions Saving and scraping a website with Puppeteer Cutting the mustard - 2018 edition Wordpress as CMS for your JAMStack sites My most favourite podcast episodes in 2017 My most favourite talks in 2017 My most favourite books in 2017 The Best Request Is No Request, Revisited Not so hidden figures - Organizing ScriptConf My podcast journey to ScriptCast Grid layout, grid layout everywhere! #scriptconf and #devone
Of mice and touches
2012-05-01 · via oida.dev | TypeScript, Rust

Unbelievable, but true: Imagine you bought a new Windows Phone 7 (e.g. Nokia Lumia or Samsung Omnia) with "Mango" on it and try to get your mobile web app running, you will be really surprised when finding out, that there's no touch event available.

"But that's what i do", you will say, "I touch my shiny phone all the time!". And you are right with that, nonetheless, IE9 mobile does not register touchstart, touchend or touchmove. Instead of those well known events, IE9 thinks of your finger as a mouse.

Usually, when developing for mobile web apps, you will have some code like this in your JS:

var clickevent = (ontouchstart in window) ? 'touchstart' : 'click';

And add event listeners using that variable.


elem.addEventListener(clickevent, function(e) {
  ...
});

IE9 is no touch browser

That's good for developing your web app on the desktop as well as testing/using it on your mobile device. Even for IE9 Mobile, since all mobile browsers can handle onclick. But once you need gestures, you're going to need mouse events for deskop and IE9 Mobile.

Onfortunately, the touch event objects, while not that much different from mouse events in terms of properties, differ in one significant point: There can be more than one touch event at a time.

A way of handling both mouse and touch events would be something like this, considering you allow just one touch at a time and don't need complex touch related stuff:


elem.addEventListener('touchstart', function(ev) {
  myMethod(ev.changedTouches[0]);
});

elem.addEventListener('mousedown', myMethod);

function myMethod(ev) {
  //do something with ev.screenX and ev.screenY
}

Same for touchend --> mouseup and touchmove --> mousemove.

This also means: it is not possible to have multi-touch gestures in IE9 Mobile

Why does IE9 Mobile behave so different?

There's one simple explanation: Microsoft tried to put the whole IE9 "experience" to mobile devices, so what you can expect from IE9 mobile is the same as from IE9 on desktops.

Well, that's not entirely true. There are some more differences:

What's in IE9 mobile that's missing from the desktop version

  • viewport meta-tag, well almost. The scale properties are not supported (which is a bummer)
  • -ms-text-size-adjust is added as CSS property, works the same as -webkit-text-size-adjust
  • GPS support for geocoding

What you will miss in IE9 mobile

  • Downloadable fonts. Font face is supported, but fonts aren't cached
  • Cross window communication
  • CMYK images (do we need that?)
  • Streaming audio. And that leads us to this issue we had to face once

Actually, it's quite nice that the mobile version of this browser behaves almost the same as the desktop browser, which makes developing alot easier. On the other hand, I think a touch device, and thus a browser on a touch device, is much more different than your average desktop. So we also need a certain differency in behaviour! The features added by the touch event on mobile webkit browsers allow us much more flexibilty and possibilites for our web apps. Furthermore, it's just wrong to treat your finger as a mouse.

Related Articles