node-bindings-guide
node-bindings-guide copied to clipboard
No longer valid for latest Node
I found this to be a fantastic resource for creating my first Node Addon. Unfortunately, it seems no longer valid for the latest Node since the v8 API has had breaking changes.
An updated version would certainly help noobs like myself (and I'm sure others).
Thanks for all of your hard work on this reference.
re http://luismreis.github.io/node-bindings-guide/docs/returning.html
Context::GetCurrent()->Global()
Context doesn't have any static functions anymore
This is the current way one can return a typed array buffer... without getting the function from global can calling it that way.
size_t length;
// SharedArrayBuffer can be ArrayBuffer instead; in this context they appear the same.
// passes external pointer (in this case to the image data of an image)
Local<SharedArrayBuffer> ab =
SharedArrayBuffer::New( isolate,
GetImageSurface( io->image ),
length = io->image->height * io->image->pwidth );
Local<Uint8Array> ui = Uint8Array::New( ab, 0, length );