INNER CODE UNIT · JavaScript

addedPromise

Meteor-Community-Packages/meteor-publish-composite · lib/publication.js:36

        const addedPromise = new Promise((resolve, reject) => {
          // call the async function to handle the 'added' logic
          this._handleAddedAsync(doc, collectionName)
            .then(resolve) // resolve the promise at the end of the 'added' callback
            .catch(reject)
        })

        // store the promise
        this.promises.push(addedPromise)
      }),
      changed: Meteor.bindEnvironment((newDoc, oldDoc) => {
        debugLog('Publication.observeHandle.changed', `${collectionName}:${newDoc._id}`)
        this._republishChildrenOf(newDoc)
        this.subscription.changed(collectionName, newDoc._id,
          [...new Set([...Object.keys(newDoc), ...Object.keys(oldDoc)])]
            .filter(key => newDoc[key] !== oldDoc[key])
            .reduce((changes, key) => ({ ...changes, [key]: newDoc[key] }), {}))
      }),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…