Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript error: deref is not a function (electron v1.6.7 / node 7.9.0) #98

Open
nicolas-vergnes-fr opened this issue Nov 8, 2017 · 2 comments

Comments

@nicolas-vergnes-fr
Copy link

Hi,

I already use ref module in a full Node.js (7.9.0) environnement. I do the following thing without any trouble:
let size = Buffer.alloc(4, 0);
size.type = ref.types.uint;
console.log('size:', size.deref());

Now I try to execute the same code in electron runtime (with the same Node version) and I get a different behaviour. This time size.deref is undefined. Indeed there is no deref filed in size.__proto__.

The only difference I could see with console.log is that my buffer instance is a Uint8Array in the electron runtime, but when I check Buffer.isBuffer(size) I get true.

Example:
let size: any = Buffer.alloc(4, 0);
size.type = ref.types.uint;
console.log('size:', size, JSON.stringify(size));
console.log('size.deref:', size.deref);
console.log('size.type:', size.type);
console.log('isBuffer:', Buffer.isBuffer(size));

screenshot_20171108_174121

Any ideas?

Thanks
PS: great job! FFI and REF are really cool!

@nicolas-vergnes-fr
Copy link
Author

Nobody meets the same problem? Any ideas?

@xmsz-stu
Copy link

xmsz-stu commented Sep 2, 2023

any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants