node-bindings-guide icon indicating copy to clipboard operation
node-bindings-guide copied to clipboard

No longer valid for latest Node

Open floralsystems opened this issue 11 years ago • 1 comments

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.

floralsystems avatar Dec 05 '14 21:12 floralsystems

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 );

d3x0r avatar Nov 08 '16 22:11 d3x0r