INNER CODE UNIT · JavaScript

DocumentRefCounter

Meteor-Community-Packages/meteor-publish-composite · lib/doc_ref_counter.js:3

class DocumentRefCounter {
  constructor (observer) {
    this.heap = {}
    this.observer = observer
  }

  increment (collectionName, docId) {
    const key = `${collectionName}:${valueOfId(docId)}`
    if (!this.heap[key]) {
      this.heap[key] = 0
    }
    this.heap[key] += 1
  }

  decrement (collectionName, docId) {
    const key = `${collectionName}:${valueOfId(docId)}`
    if (this.heap[key]) {
      this.heap[key] -= 1

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…