30 lines
535 B
JavaScript
30 lines
535 B
JavaScript
|
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"
|
||
|
})
|