Blocking the main thread with intensive processing, even really short intensive processing, is not a great practice. Besides, what if someone decides to scan a ridiculously long document? That would block the main thread for way too long (and also probably overflow the Wasm memory). In #4 I guess I kind of implied that the documents would need to be saved to IndexedDB or something persistent to process them in a worker, but that's stupid because I can just message the worker the blob URLs. (I don't even remember if I knew blob URLs existed yet back in the days of old Doclight. I could probably look and see but I think I might have been passing around massive data URLs between threads. How naïve I once was.)
Maybe this should be a shared worker? It's not like I'm expecting users to have a whole bunch of Doclight tabs open, so it doesn't matter all that much, but a shared worker would be good for memory efficiency in that case (particularly since all the tabs would share a Wasm instance) and doesn't hurt the expected case at all and also it would be fun to play with shared workers. Just gotta figure out how those work in Webpack... but that's no different from regular workers either.
Blocking the main thread with intensive processing, even really short intensive processing, is not a great practice. Besides, what if someone decides to scan a ridiculously long document? That would block the main thread for way too long (and also probably overflow the Wasm memory). In #4 I guess I kind of implied that the documents would need to be saved to IndexedDB or something persistent to process them in a worker, but that's stupid because I can just message the worker the blob URLs. (I don't even remember if I knew blob URLs existed yet back in the days of old Doclight. I could probably look and see but I think I might have been passing around massive data URLs between threads. How naïve I once was.)
Maybe this should be a shared worker? It's not like I'm expecting users to have a whole bunch of Doclight tabs open, so it doesn't matter all that much, but a shared worker would be good for memory efficiency in that case (particularly since all the tabs would share a Wasm instance) and doesn't hurt the expected case at all and also it would be fun to play with shared workers. Just gotta figure out how those work in Webpack... but that's no different from regular workers either.