Skip to content

Commit b958517

Browse files
committed
Rename Listening#backbone to Listening#interop
A more descriptive name for what the property signifies.
1 parent 4bd7ec8 commit b958517

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

backbone.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
listeners[_listening.id] = _listening;
128128
// Allow the listening to use a counter, instead of tracking
129129
// callbacks for library interop
130-
_listening.backbone = true;
130+
_listening.interop = false;
131131
}
132132

133133
return this;
@@ -154,7 +154,7 @@
154154

155155
if (error) throw error;
156156
// If the target obj is not Backbone.Events, track events manually.
157-
if (!listening.backbone) listening.on(name, callback);
157+
if (listening.interop) listening.on(name, callback);
158158

159159
return this;
160160
};
@@ -210,7 +210,7 @@
210210
if (!listening) break;
211211

212212
listening.obj.off(name, callback, this);
213-
if (!listening.backbone) listening.off(name, callback);
213+
if (listening.interop) listening.off(name, callback);
214214
}
215215
return this;
216216
};
@@ -343,7 +343,7 @@
343343
this.id = listener._listenId;
344344
this.listener = listener;
345345
this.obj = obj;
346-
this.backbone = false;
346+
this.interop = true;
347347
this.count = 0;
348348
this._events = void 0;
349349
};
@@ -356,23 +356,23 @@
356356
// library interop.
357357
Listening.prototype.off = function(name, callback) {
358358
var cleanup;
359-
if (this.backbone) {
360-
this.count--;
361-
cleanup = this.count === 0;
362-
} else {
359+
if (this.interop) {
363360
this._events = eventsApi(offApi, this._events, name, callback, {
364361
context: void 0,
365362
listeners: void 0
366363
});
367364
cleanup = !this._events;
365+
} else {
366+
this.count--;
367+
cleanup = this.count === 0;
368368
}
369369
if (cleanup) this.cleanup();
370370
};
371371

372372
// Cleans up memory bindings between the listener and the listenee.
373373
Listening.prototype.cleanup = function() {
374374
delete this.listener._listeningTo[this.obj._listenId];
375-
if (this.backbone) delete this.obj._listeners[this.id];
375+
if (!this.interop) delete this.obj._listeners[this.id];
376376
};
377377

378378
// Proxy Underscore methods to a Backbone class' prototype using a

0 commit comments

Comments
 (0)