emscripten-core / emscripten-core/emscripten

extend worker sent an error! Uncaught TypeError: Cannot read properties of undefined (reading 'Callback')

Open
#22,388 0 comments 0 reactions 1 assignee Claimed by @brendandahl View on GitHub
embind
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

v 3.1.60,v3.1.64

I use this simple example in my project and it works for non pthread building.
https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#extend-example

But then I compile with pthread I got random (through one or two page reloads) error:

`worker sent an error! https://localhost:4443/wasm.js:71: Uncaught TypeError: Cannot read properties of undefined (reading 'Callback')`

```
const delegate = MODULE.Delegate.extend( "Delegate", {
__construct: function () {
this.__parent.__construct.call(this);
},
__destruct: function () {
this.__parent.__destruct.call(this);
},
Callback: function (jmessage) {
console.log(jmessage);
},
}
);

let d = new delegate();
```

How can I try to figure out what the cause of the error is?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.