mosaicode/extensions/javascript/blocks/webaudio/Input Device/Hour.json

57 lines
2.1 KiB
JSON

{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "javascript.input devices.hour",
"language": "javascript",
"extension": "webaudio",
"help": "Hour",
"label": "Hour",
"color": "#4283FA",
"group": "Input Device",
"codes": [
{
"name": "declaration",
"code": "\n// block_$id$ = $label$\nvar $port[hour]$ = [];\nvar $port[minute]$ = [];\nvar $port[second]$ = [];\nvar $port[millisecond]$ = [];\nvar $port[time]$ = [];\n\nvar $port[generate]$ = function(value){\n var d = new Date();\n for (var i = 0; i < $port[hour]$.length ; i++){\n $port[hour]$[i](d.getHours());\n }\n for (var i = 0; i < $port[minute]$.length ; i++){\n $port[minute]$[i](d.getMinutes());\n }\n for (var i = 0; i < $port[second]$.length ; i++){\n $port[second]$[i](d.getSeconds());\n }\n for (var i = 0; i < $port[millisecond]$.length ; i++){\n $port[millisecond]$[i](d.getMilliseconds());\n }\n for (var i = 0; i < $port[time]$.length ; i++){\n $port[time]$[i](d.getTime());\n }\n return true;\n };\n\n"
}
],
"properties": [],
"ports": [
{
"conn_type": "output",
"name": "hour",
"label": "Hour",
"type": "javascript.float"
},
{
"conn_type": "output",
"name": "minute",
"label": "Minute",
"type": "javascript.float"
},
{
"conn_type": "output",
"name": "second",
"label": "Second",
"type": "javascript.float"
},
{
"conn_type": "output",
"name": "millisecond",
"label": "Millisecond",
"type": "javascript.float"
},
{
"conn_type": "output",
"name": "time",
"label": "Time",
"type": "javascript.float"
},
{
"conn_type": "input",
"name": "generate",
"label": "Generate",
"type": "javascript.float"
}
]
}