async-json icon indicating copy to clipboard operation
async-json copied to clipboard

about polyfill

Open Kikobeats opened this issue 9 years ago • 1 comments

I feel that polyfills are dangerous: you are wrapping a sync method as async method. With the callback / promise you are simulating a async method, but the implementation is synchronously and will block the main thread.

Two solutions: implement a native JSON.parse async or move the sync JSON.parse work at the end of the event loop. I was working in the last option in this repository: https://github.com/Kikobeats/json-parse-async

Kikobeats avatar Aug 03 '15 14:08 Kikobeats

#7 is addressing event loop related issues.

Also in browsers with workers it is possible to do some operations in a worker and transfer the data via structured clone algorithm.

mohsen1 avatar Aug 03 '15 15:08 mohsen1