Hacker News new | ask | show | jobs
by efxzsh 3980 days ago
Hmm, ok but why not

function asyncParse(string) { return new Promise(function(res, rej) { resolve(JSON.parse(string)); }); }

- or -

let asyncParse = async (string) => JSON.parse(string);

1 comments

Promises still run in the main thread and will block other javascript. The purpose of this hack is to move the parsing out of the main thread.
Ok, get it. Thx