render in worker thread

This commit is contained in:
Ian Gulliver
2019-07-03 22:10:36 +00:00
parent 27411817b1
commit 3d0d0d5fd0
2 changed files with 45 additions and 10 deletions

View File

@@ -1,8 +1,13 @@
function render(def) {
let graph = new Graph(def);
addEventListener('message', (e) => {
let graph = new Graph(e.data);
let layout = new Layout(graph);
return layout.getDrawSteps();
}
postMessage({
generation: e.data.generation,
steps: layout.getDrawSteps(),
});
});
<!--# include file="Graph.js" -->
<!--# include file="Layout.js" -->
<!--# include file="utils.js" -->