-
Notifications
You must be signed in to change notification settings - Fork 812
Open
Description
As we discussed in the PR over node-sketch-bridge, I'm working on writing a "pure" implementation of makeImageDataFromUrl(), using fetch and @skpm/fs.
There is one major problem implementing it in this way though: fetch is asynchronous, while the whole rendering operation is synchronous.
Now, I see two ways around this:
- I keep pieces of the existing implementation that uses
NSDataaround, and keep everything sync. Not surprisingly, NSData documentation has a big fat warning about not using it for network requests, though, because it can potentially hang the whole thing if the network is slow/unresponsive. The pro is that I can keep the existing interface. The con is that, as per current implementation, it can potentially hang Sketch, and the implementation is less uniform. - Make
makeImageDataFromUrlreturn a Promise and make the whole chain of functions up torenderasync as well. This allows us to usefetch, makes the whole thing faster in cases where there are multiple images in a layout, and in general less prone to hang, but it's a breaking change.
@mathieudutour Thoughts?
Metadata
Metadata
Assignees
Labels
No labels