Ergonomic Promise
-based Image
loading
#7419
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: img
Currently we need to write something like this (ignoring error handling):
It would be useful if this could be done with a one-liner. Maybe something like this:
This isn't a proposal of any particular specifics of the API - I have no opinion there other than it being a one-liner to load an image. The above code snippet is just a placeholder example to get across the general idea. I'd hope that someone else with more experience would step in to fill in the concrete details.
The motivation is not so much about reducing lines of code as it is about making the intention more readable. The promisified onload approach is hacky and hard to read.
I wouldn't be surprised is something like this has been proposed before, but a quick couple of searches didn't surface anything, so apologies if I missed a previous/existing discussions/proposals.
The text was updated successfully, but these errors were encountered: