Skip to content

Commit

Permalink
Fix callbacks still being called after destroy()
Browse files Browse the repository at this point in the history
  • Loading branch information
Johni0702 committed Sep 20, 2017
1 parent ef4f29c commit 9f8bd90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ module.exports = function(audioContext, stream, opts) {

function disconnect() {
scriptProcessorNode.disconnect();
analyser.disconnect();
source.disconnect();
}

function destroy() {
captureTimeout && clearTimeout(captureTimeout);
disconnect();
scriptProcessorNode.onaudioprocess = null;
}

function monitor() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voice-activity-detection",
"version": "0.0.4",
"version": "0.0.5",
"description": "Mic input activity detection",
"main": "index.js",
"license": "MIT",
Expand Down

0 comments on commit 9f8bd90

Please sign in to comment.