3 ms·
search("test") is not an asynchronous call, in your example, because there's no callback function. (In JavaScript) defer() is needed because it becomes the pla
by crazygringo 15y ago
search("test") is not an asynchronous call, in your example, because there's no callback function. (In JavaScript)
defer() is needed because it becomes the placeholder for the callback function, and lets Iced know how many functions it needs to wait to call back.
- xpaulbettsx 15y agoIn other words, JavaScript doesn't return a Promise/Future/Task<T>, so the defer syntax is necessary. You could get rid of it by simply capturing the callback params and returning them as a value, though your code would end up having a lot of `[0]`'s in them, since most callbacks are of the form (thing, err)