3 ms·
ChromoZoom (http://chromozoom.org http://chromozoom.org) uses web workers to offload custom track drawing to a background thread. If all the data processing we
by pak 14y ago
ChromoZoom (http://chromozoom.org http://chromozoom.org) uses web workers to offload custom track drawing to a background thread. If all the data processing were done on the main thread, the UI would stall. However, unlike this library, I don't rely on passing all the JS to an eval() on the worker thread; I have the worker and the main thread load the same code, and refer to the methods by name. This makes it easier and more organized, IMO, when dropping back to non-web-worker operation.
https://github.com/rothlab/chromozoom/blob/master/js/CustomTrackWorker.js https://github.com/rothlab/chromozoom/blob/master/js/CustomT...
and the top 135 lines of
https://github.com/rothlab/chromozoom/blob/master/js/CustomTracks.js https://github.com/rothlab/chromozoom/blob/master/js/CustomT...
show how we do it.