pxt-calliope/tdworker.js

30 lines
535 B
JavaScript
Raw Normal View History

2017-08-19 17:16:35 +02:00
var window = self;
window.localStorage = {}
function require() { return null }
importScripts(
"/pxt-calliope/tdast.js"
)
onmessage = function(ev) {
var data = ev.data
if (data.op == "td2ts") {
var r = TDev.AST.td2ts(data.arg)
postMessage({
id: data.id,
op: data.op,
result: r
})
} else {
postMessage({
id: data.id,
op: data.op,
error: "Command not understood"
})
}
}
postMessage({
id: "ready"
})