Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ctx.addEventListener('message', event => {
switch(event.data.type){
case "add-node":
let properties = event.data.properties;
let node = Node.create() as any;
nodes[event.data.uuid] = {
uuid:event.data.uuid,
node:node,
parent:null,
children:[],
width:event.data.width
};
for(let method in properties){
if(properties.hasOwnProperty(method)&&method.indexOf('Edge')===-1){
if(["setMarginLeft","setMarginPercentLeft","setPaddingLeft","setBorderLeft","setPositionLeft","setPositionPercentLeft"]
.indexOf(method)>-1){
node[method.replace('Left','')](EDGE_LEFT,properties[method]);
}else if(["setMarginRight","setMarginPercentRight","setPaddingRight","setBorderRight","setPositionRight","setPositionPercentRight"]
.indexOf(method)>-1){
node[method.replace('Right','')](EDGE_RIGHT,properties[method]);