#include <node.h>
#include <nan.h>
using namespace v8;
NAN_METHOD(Method) {
NanScope();
v8::Handle<v8::Object> buffer = args[0]->ToObject();
bool hasIndexed = buffer->HasIndexedPropertiesInExternalArrayData();
// print buffer has indexed properties or not.
printf("hasINDEXED = %d\n", hasIndexed);
NanReturnValue(NanSymbol("world"));
}
void init(Handle<Object> exports) {
exports->Set(NanSymbol("hello"),
FunctionTemplate::New(Method)->GetFunction());
}
NODE_MODULE(addon, init)
var addon = require('./build/Release/addon');
var f64a = new Uint32Array(8);
// hasIndexed is true in v0.11, v0.10
addon.hello(f64a);
// hasIndexed is false in v0.11, but v0.10 is true...
// addon.hello(f64a.buffer);
module.exports = addon;
all code is here.
https://github.com/yosuke-furukawa/nansample/tree/test/buffer