luin / readability

📚 Turn any web page into a clean view
2.49k stars 313 forks source link

Synchronous functionality when passing raw html #91

Open krazyjakee opened 7 years ago

krazyjakee commented 7 years ago

There is no reason the parser should run asynchronously when passing raw html as there is no request to be made.

Usage should be something like...

const readability = read(rawHtml);
// readability = { err, article, meta }
mhamann commented 7 years ago

Not true. The read/parse logic could be CPU intensive and block for quite awhile. With promises and async/await, it shouldn't make much difference, except for not blocking the main thread (which is a good thing!).

krazyjakee commented 7 years ago

@mhamann doh! I should have thought about that. I would be satisfied with a promise/asyncawait solution too but then may as well do a total ES8 rewrite. I don't have time for it unfortunately.