godotjs / godotjs/javascript

Unable to rebind ECMAScript instance from godot object in threaded worker.js

オープン
#108 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
investigation
主要言語
C++
スター
1.1k
フォーク
80
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

```javascript
// 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) })
}
}
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

parcel.tsx、grid.tsx、worker.js から始め、godot.abandon_value、godot.adopt_value、および worker の onmessage ハンドラーに注目してください。[Spatial] の結果を再現し、test_function と call に期待される動作を特定してください。issue ではどちらかが指定されていませんが、done は確認済みの修正または明確に文書化された制限事項のいずれかである必要があります。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
game-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。