Skip to content

Commit bc72830

Browse files
author
Christoph Oberhofer
committed
Added methods to remove handlers from event-queue
1 parent 3a1468d commit bc72830

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
quaggaJS
22
========
33

4-
- [Changelog](#changelog) (2015-07-29)
4+
- [Changelog](#changelog) (2015-08-13)
55

66
## What is QuaggaJS?
77

@@ -141,6 +141,16 @@ In contrast to the calls described above, this method does not rely on
141141
`getUserMedia` and operates on a single image instead. The provided callback
142142
is the same as in `onDetected` and contains the result `data` object.
143143

144+
### Quagga.offProcessed(handler)
145+
146+
In case the `onProcessed` event is no longer relevant, `offProcessed` removes
147+
the given `handler` from the event-queue.
148+
149+
### Quagga.offDetected(handler)
150+
151+
In case the `onDetected` event is no longer relevant, `offDetected` removes
152+
the given `handler` from the event-queue.
153+
144154
## <a name="resultobject">The result object</a>
145155

146156
The callbacks passed into `onProcessed`, `onDetected` and `decodeSingle`
@@ -367,6 +377,11 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
367377

368378
## <a name="changelog">Changelog</a>
369379

380+
### 2015-08-13
381+
- Improvements
382+
- Added `offProcessed` and `offDetected` methods for detaching event-
383+
listeners from the event-queue.
384+
370385
### 2015-07-29
371386
- Features
372387
- Added basic support for [ITF][i2of5_wiki] barcodes (`i2of5_reader`)

dist/quagga.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9204,9 +9204,15 @@ function(InputStream,
92049204
onDetected : function(callback) {
92059205
Events.subscribe("detected", callback);
92069206
},
9207+
offDetected: function(callback) {
9208+
Events.unsubscribe("detected", callback);
9209+
},
92079210
onProcessed: function(callback) {
92089211
Events.subscribe("processed", callback);
92099212
},
9213+
offProcessed: function(callback) {
9214+
Events.unsubscribe("processed", callback);
9215+
},
92109216
setReaders: function(readers) {
92119217
setReaders(readers);
92129218
},

dist/quagga.min.js

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quagga",
3-
"version": "0.6.14",
3+
"version": "0.6.15",
44
"description": "An advanced barcode-scanner written in JavaScript",
55
"main": "dist/quagga.js",
66
"devDependencies": {

src/quagga.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,15 @@ function(InputStream,
452452
onDetected : function(callback) {
453453
Events.subscribe("detected", callback);
454454
},
455+
offDetected: function(callback) {
456+
Events.unsubscribe("detected", callback);
457+
},
455458
onProcessed: function(callback) {
456459
Events.subscribe("processed", callback);
457460
},
461+
offProcessed: function(callback) {
462+
Events.unsubscribe("processed", callback);
463+
},
458464
setReaders: function(readers) {
459465
setReaders(readers);
460466
},

0 commit comments

Comments
 (0)