Skip to content

Commit dad7e7b

Browse files
cleaned up and moved multiplexer
1 parent 91d6790 commit dad7e7b

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lib/cache/ObservableCollection.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,6 @@ export default class ObservableCollection {
176176
return this.store.has(docId);
177177
}
178178

179-
/**
180-
* Sends the data to the multiplexer
181-
*
182-
* @param event
183-
* @param args
184-
*/
185-
send(event, ...args) {
186-
this.multiplexer[event].call(null, ...args);
187-
}
188-
189179
/**
190180
* @param doc {Object}
191181
* @param safe {Boolean} If this is set to true, it assumes that the object is cleaned
@@ -200,7 +190,7 @@ export default class ObservableCollection {
200190
}
201191

202192
this.store.set(doc._id, doc);
203-
this.send('added', doc._id, doc);
193+
this.multiplexer.added(doc._id, doc);
204194
}
205195

206196
/**
@@ -213,7 +203,7 @@ export default class ObservableCollection {
213203
this.store.set(docId, doc);
214204

215205
if (doc) {
216-
this.send('added', doc._id, doc);
206+
this.multiplexer.added(doc._id, doc);
217207
}
218208
}
219209

@@ -241,7 +231,7 @@ export default class ObservableCollection {
241231
);
242232

243233
if (!_.isEmpty(changed)) {
244-
this.send('changed', docId, changed);
234+
this.multiplexer.changed(docId, changed);
245235
}
246236
}
247237

@@ -263,7 +253,7 @@ export default class ObservableCollection {
263253

264254
var changed = DiffSequence.makeChangedFields(storedDoc, oldDoc);
265255

266-
this.send('changed', docId, changed);
256+
this.multiplexer.changed(docId, changed);
267257
}
268258

269259
/**
@@ -273,7 +263,7 @@ export default class ObservableCollection {
273263
const doc = this.store.pop(docId);
274264
if (doc != null) {
275265
try {
276-
this.send('removed', docId, doc);
266+
this.multiplexer.removed(docId, doc);
277267
} catch (e) {
278268
// Supressing `removed non-existent exceptions`
279269
if (!isRemovedNonExistent(e)) {

0 commit comments

Comments
 (0)