aboutsummaryrefslogtreecommitdiff
path: root/node_modules/algoliasearch/src/IndexBrowser.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/algoliasearch/src/IndexBrowser.js')
-rw-r--r--node_modules/algoliasearch/src/IndexBrowser.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/node_modules/algoliasearch/src/IndexBrowser.js b/node_modules/algoliasearch/src/IndexBrowser.js
new file mode 100644
index 00000000..b035a200
--- /dev/null
+++ b/node_modules/algoliasearch/src/IndexBrowser.js
@@ -0,0 +1,39 @@
+'use strict';
+
+// This is the object returned by the `index.browseAll()` method
+
+module.exports = IndexBrowser;
+
+var inherits = require('inherits');
+var EventEmitter = require('events').EventEmitter;
+
+function IndexBrowser() {
+}
+
+inherits(IndexBrowser, EventEmitter);
+
+IndexBrowser.prototype.stop = function() {
+ this._stopped = true;
+ this._clean();
+};
+
+IndexBrowser.prototype._end = function() {
+ this.emit('end');
+ this._clean();
+};
+
+IndexBrowser.prototype._error = function(err) {
+ this.emit('error', err);
+ this._clean();
+};
+
+IndexBrowser.prototype._result = function(content) {
+ this.emit('result', content);
+};
+
+IndexBrowser.prototype._clean = function() {
+ this.removeAllListeners('stop');
+ this.removeAllListeners('end');
+ this.removeAllListeners('error');
+ this.removeAllListeners('result');
+};