{"metadata":{"version":1,"view":"all"},"components":[{"type":"data","name":"inputs","visible":true,"data":{"A":46,"B":56},"params":{"format":"json","display":"gui","form":"object","headers":["A","B"],"afterChange":"Hyperdeck.Run('calculations')"}},{"type":"js","name":"calculations","visible":true,"text":"\nvar inputs = Hyperdeck.Get('inputs');\nvar outputs = {};\n\noutputs.C = inputs.A + inputs.B;\n\nHyperdeck.Set('outputs', outputs);\nHyperdeck.Run('generate');\n","display":"codemirror","mode":"default","runOnBlur":false,"runOnLoad":false},{"type":"data","name":"outputs","visible":false,"data":{"C":102},"params":{"format":"json","display":"readonly","form":"object","headers":["C"],"afterChange":""}},{"type":"txt","name":"template","visible":true,"text":"@A + @B = @C","display":"codemirror","mode":"default","runOnBlur":false,"runOnLoad":false},{"type":"js","name":"generate","visible":false,"text":"\nvar text = Hyperdeck.Get('template');\nvar inputs = Hyperdeck.Get('inputs');\nvar outputs = Hyperdeck.Get('outputs');\n\nfor (var key in inputs)\n{\n var val = inputs[key];\n \n while (text.search('@' + key) >= 0)\n {\n \ttext = text.replace('@' + key, val);\n }\n}\n\nfor (var key in outputs)\n{\n var val = outputs[key];\n \n while (text.search('@' + key) >= 0)\n {\n \ttext = text.replace('@' + key, val);\n }\n}\n\ntext = '<p>' + text + '</p>';\ntext = text.replace(/\\n/g, '</p><p>');\nreturn text;\n","display":"codemirror","mode":"htmlgen","runOnBlur":true,"runOnLoad":true}]}