Created
May 18, 2015 19:02
-
-
Save trevnorris/cd3fed818558e96b3900 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <v8.h> | |
| #include <node.h> | |
| using namespace v8; | |
| class Visitor42 : public PersistentHandleVisitor { | |
| public: | |
| virtual void VisitPersistentHandle(Persistent<Value>* value, | |
| uint16_t class_id) { | |
| if (class_id == 0xA10C) | |
| fprintf(stderr, "Found a Buffer\n"); | |
| } | |
| }; | |
| Visitor42* v42; | |
| void RunMe(const FunctionCallbackInfo<Value>& args) { | |
| v42 = new Visitor42(); | |
| } | |
| void Reset(const FunctionCallbackInfo<Value>& args) { | |
| V8::VisitHandlesWithClassIds(args.GetIsolate(), v42); | |
| } | |
| void init(Handle<Object> exports) { | |
| NODE_SET_METHOD(exports, "runMe", RunMe); | |
| NODE_SET_METHOD(exports, "reset", Reset); | |
| } | |
| NODE_MODULE(addon, init) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment