svg-layout-designer-react/public/workers/worker.js
Eric Nguyen 57e6c9a156 Merged PR 173: Implements API methods through right click + more (read desc)
- Implements API methods through right click
- Refactor events
- Refactor usage of setHistory and setHistoryCurrentStep into a single function
- Update ContainerOperations documentations
- Added AddContainers in order to add multiple containers + refactor AddContainer to use it
- Fix regression
- Fix AddContainer at index
2022-08-30 14:45:29 +00:00

22 lines
428 B
JavaScript

onmessage = (e) => {
const data = JSON.stringify(e.data.editorState, getCircularReplacer(), e.data.spaces);
postMessage(data);
};
const getCircularReplacer = () => {
return (key, value) => {
if (key === 'parent') {
return;
}
if (key === 'symbols') {
return Array.from(value.entries());
}
if (key === 'linkedContainers') {
return Array.from(value);
}
return value;
};
};