3 ms·
> ...which in turn uses the Compression Streams API when supported > ...uses OffscreenCanvas when available I think it's a mistake to write your code to autom
by jmull 4y ago
> ...which in turn uses the Compression Streams API when supported
> ...uses OffscreenCanvas when available
I think it's a mistake to write your code to automatically use new platform capabilities when they become available if you won't have an adequate chance to validate them first.
It's just too optimistic to believe a new implementation of a low-level mechanism is going to work exactly the way you need. (1) new things have new bugs; (2) changes are you'll end up depending on implementation details that will vary between different implementations.
- jefftk 4y agoWhat should you do instead? The alternative is UA-sniffing, and that's worse: https://news.ycombinator.com/item?id=35425549 https://news.ycombinator.com/item?id=35425549
- jmull 4y ago> What should you do instead? It's your choice: (1) don't use it; (2) validate it before using it; (3) roll the dice on behalf of your users -- that is, use it without validating it. Don't let religious beliefs around UA-sniffing cause you to screw over your users.
- AshleysBrain 4y agoBrowser makers, including Apple, always say to use feature detection - i.e. to use features when they appear to be available. The alternative is user-agent sniffing, which they advise against.
- kevincox 4y agoYeah, this is the problem with feature detection which isn't talked about enough. It is often easy enough to detect whole APIs or even some new methods but correct functionality and optional parameters can be hard or impossible to test. In most cases I have found that feature detection + a blacklist of problematic browsers is often a good compromise. But there is no perfect solution.