ktye / i

interpret
100 stars 17 forks source link

zoo: add kap #23

Closed ktye closed 1 year ago

ktye commented 1 year ago

https://codeberg.org/loke/array/src/branch/master/clientweb2/src/jsclientMain/kotlin/array/clientweb2/clientweb2.kt#L31

ktye commented 1 year ago
var worker = new Worker("compute-queue-worker.js")
worker.onmessage = function(event) {
    console.log("Incoming event: " + event.data);
}
worker.postMessage(Json.encodeToString({src: "1+2"}));

These files should be in the same directory: https://codeberg.org/loke/array/src/branch/master/array/standard-lib

They are: EngineStartedDescriptor which is sent when the engine is ready to receive commands. EvalResponse is sent when a result is ready, the result member is the result formatted as a string. OutputDescriptor is sent when the executing code prints something using print ExceptionDescriptor is sent when there is an error before the code is actually executed (for example, a parse error) And finally, EvalExceptionDescriptor is a message sent when KAP code raises an error. The pos member is a description of the line/col where the error occurred (for error highlighting) callerName is the name of the function where the error occurred, if available.

fs: https://codeberg.org/loke/array/src/branch/master/array/src/jsMain/kotlin/array/io-js.kt