Hacker News new | ask | show | jobs
by vincentriemer 2956 days ago
Chrome (and the web platform in general) has been moving to this model of features/APIs needing to be called "as a result of a user interaction". This sounds reasonable in theory, but like I recently realized, chrome cannot detect if a call was in a response to a user gesture 100% of the time.

I've been experimenting with an architecture where all app logic lives in a web worker, so in order to respond to events, the event gets handled on the main thread and forwarded to the worker, where it then triggers app logic which sends commands back to the main thread.

Problem is, once you cross a thread boundary, you lose all the context which classifies your calls as "in result of a user gesture", so you need to resort to hacky workarounds that force you to keep your app logic on the main thread :(