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

No longer valid for latest Node #4

Open
floralsystems opened this issue Dec 5, 2014 · 1 comment
Open

No longer valid for latest Node #4

floralsystems opened this issue Dec 5, 2014 · 1 comment

Comments

@floralsystems
Copy link

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.

@d3x0r
Copy link

d3x0r commented Nov 8, 2016

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

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