
338 21. e BrainBrowser Surface Viewer
21.3.1 Data Flow
Data coming into the Surface Viewer proceed through several steps to prepare them for
display. Heavier data parsing steps are handled by Web Workers to avoid blocking the
main UI and rendering thread. Whenever possible, data are passed to and from Web
Workers as transferable objects
*
to avoid the overhead associated with structured cloning
†
(Listing 21.2). For more details on transferable objects, refer to Chapter 4.
Listing 21.2 Passing parsed geometry data as transferable objects from a Web Worker
to the main thread.
var result = {};
var transfer = [];
result.vertices = new Float32Array