Skip to content

Commit

Permalink
Added methods to remove handlers from event-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Oberhofer committed Aug 13, 2015
1 parent 3a1468d commit bc72830
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
quaggaJS
========

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

## What is QuaggaJS?

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

### Quagga.offProcessed(handler)

In case the `onProcessed` event is no longer relevant, `offProcessed` removes
the given `handler` from the event-queue.

### Quagga.offDetected(handler)

In case the `onDetected` event is no longer relevant, `offDetected` removes
the given `handler` from the event-queue.

## <a name="resultobject">The result object</a>

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

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

### 2015-08-13
- Improvements
- Added `offProcessed` and `offDetected` methods for detaching event-
listeners from the event-queue.

### 2015-07-29
- Features
- Added basic support for [ITF][i2of5_wiki] barcodes (`i2of5_reader`)
Expand Down
6 changes: 6 additions & 0 deletions dist/quagga.js
Original file line number Diff line number Diff line change
Expand Up @@ -9204,9 +9204,15 @@ function(InputStream,
onDetected : function(callback) {
Events.subscribe("detected", callback);
},
offDetected: function(callback) {
Events.unsubscribe("detected", callback);
},
onProcessed: function(callback) {
Events.subscribe("processed", callback);
},
offProcessed: function(callback) {
Events.unsubscribe("processed", callback);
},
setReaders: function(readers) {
setReaders(readers);
},
Expand Down
9 changes: 4 additions & 5 deletions dist/quagga.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quagga",
"version": "0.6.14",
"version": "0.6.15",
"description": "An advanced barcode-scanner written in JavaScript",
"main": "dist/quagga.js",
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions src/quagga.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,15 @@ function(InputStream,
onDetected : function(callback) {
Events.subscribe("detected", callback);
},
offDetected: function(callback) {
Events.unsubscribe("detected", callback);
},
onProcessed: function(callback) {
Events.subscribe("processed", callback);
},
offProcessed: function(callback) {
Events.unsubscribe("processed", callback);
},
setReaders: function(readers) {
setReaders(readers);
},
Expand Down

0 comments on commit bc72830

Please sign in to comment.