Open
Description
My main thread is sending out a ECMAscript class as a message to a worker thread using godot.abandon_value
& godot.adopt_value
, but I only get the godot object and cannot call any of the js methods on the class:
// parcel.tsx
export default class Parcel extends godot.Spatial {
test_function(){
console.log("stuff I wana run here"))
}
}
// worker.js
onmessage = function(e) {
let parcel = godot.adopt_value(e.parcel)
console.log(parcel) // [Spatial:2362]
console.log(parcel.test_function()) // undefined
console.log(parcel.call("test_function")) // error
}
// grid.tsx
export default class Grid extends godot.Spatial {
featureLoadThread
_ready(){
let p = new Parcel()
this.featureLoadThread = new Worker('res://src/worker.js')
this.featureLoadThread.onmessage = this._onmessage.bind(this);
this.featureLoadThread.postMessage({ type:"featureLoad", parcel: godot.abandon_value(p) })
}
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Backlog