diff --git a/.gitignore b/.gitignore index d8ecf76..535e588 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,10 @@ .cproject .project .lock-wscript +build*/ .DS_Store -Debug -node_modules +Debug/ +node_modules/ package-lock.json +binary/ *.log diff --git a/.npmignore b/.npmignore index 0046f11..8ebed11 100644 --- a/.npmignore +++ b/.npmignore @@ -1,14 +1,15 @@ *.log .cproject -.DS_Store .eslintrc .gitignore .idea .lock-wscript .project +binary/ +build*/ CPPLINT.cfg -Debug -examples -node_modules +Debug/ +examples/ package-lock.json -test +test/ +qt/ diff --git a/include/event-emitter.hpp b/include/event-emitter.hpp index 6c267b1..26ee91e 100644 --- a/include/event-emitter.hpp +++ b/include/event-emitter.hpp @@ -74,6 +74,8 @@ public: Nan::SetPrototypeMethod(proto, "setMaxListeners", jsSetMaxListeners); Nan::SetPrototypeMethod(proto, "rawListeners", jsRawListeners); + Nan::SetPrototypeMethod(proto, "destroy", jsDestroy); + // -------- static V8_VAR_FUNC ctor = Nan::GetFunction(proto).ToLocalChecked(); @@ -141,8 +143,14 @@ public: void _destroy() { DES_CHECK; + _isDestroyed = true; - // emit("destroy"); + + _listeners.clear(); + _raw.clear(); + _wrappedIds.clear(); + _rawIds.clear(); + } @@ -644,6 +652,15 @@ private: } + static NAN_METHOD(jsDestroy) { THIS_AUDIO_NODE; THIS_CHECK; + + eventEmitter->emit("destroy"); + + eventEmitter->_destroy(); + + } + + private: bool _isDestroyed; diff --git a/index.js b/index.js index 5567ed5..8e949ed 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ const paths = dir => { const binPath = `${dir}/${currentDir}`; if (isWindows) { - process.env.path = `${process.env.path ? `${process.env.path};` : ''}${binPath}`; + process.env.path = `${binPath};${process.env.path ? `${process.env.path}` : ''}`; } const remPath = remDirs.map(k => `${dir}/${k}`).join(' '); diff --git a/package.json b/package.json index 74dce81..fb97d13 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,31 @@ { + "author": "Luis Blanco ", "name": "addon-tools-raub", "version": "0.1.7", - "author": "Luis Blanco ", "description": "A set of extra tools for Node.js addons", + "license": "MIT", "main": "index.js", "keywords": [ - "node", - "addon", - "header", + "support", + "headers", "include", - "platform", - "build", - "paths", - "events", "eventemitter", - "emitter", - "cpp", - "compile", - "macros", - "helpers", "utils" ], + "engines": { + "node": ">=8.11.1", + "npm": ">=5.6.0" + }, "maintainers": [ { "name": "Luis Blanco", - "email": "raubtierxxx@gmail.com", + "email": "luisblanco1337@gmail.com", "skype": "rauber666" } ], - "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/raub/node-addon-tools.git" + "url": "https://github.com/node-3d/node-addon-tools.git" }, "dependencies": { "nan": "2.10.0" diff --git a/test/package.json b/test/package.json index 2f33708..cba2327 100644 --- a/test/package.json +++ b/test/package.json @@ -1,38 +1,17 @@ { - "name": "TEST", - "author": "Luis Blanco ", - "description": "TEST", - "version": "0.0.1", - "main": "mocha", - "scripts": { - "test": "mocha", - "start": "mocha" - }, - "keywords": [ - "node", - "addon", - "header", - "include", - "platform", - "build", - "paths" - ], - "maintainers": [ - { - "name": "Luis Blanco", - "email": "raubtierxxx@gmail.com", - "skype": "rauber666" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/raub/node-addon-tools.git" - }, - "dependencies": { - "addon-tools-raub": "file:../", - "chai": "^4.1.2", - "mocha": "^5.0.0", - "sinon": "^4.2.2" - } + "name": "test", + "version": "0.0.0", + "private": true, + "main": "mocha", + "scripts": { + "test": "mocha", + "start": "mocha", + "preinstall": "cd .. && npm i" + }, + "dependencies": { + "addon-tools-raub": "file:../", + "chai": "^4.1.2", + "mocha": "^5.0.0", + "sinon": "^4.2.2" + } }