plugins/polling-updater.js
function pollForNextUpdate(client, tagManager, callback) {
    let req = new Promise((resolve, reject) => {
        let methodName = tagManager ?
            "GetNextUpdateForAllManagersOnDB" :
            "GetNextUpdateForAllManagers";
        let soapMethod = client[methodName];
        let args = {};
        if (tagManager) args.dbid = tagManager.dbid;
        soapMethod(args, function(err, result) {
            if (err) return reject(err);
            let tagDataList = JSON.parse(result[methodName + "Result"]);
            try {
                if (callback) callback(null, { object: tagManager,
                                               value: tagDataList });
            } catch (e) {
                logError(console, e);
                // no good reason to escalate an error thrown by callback
            }
            resolve(tagDataList);
        });
    });
    if (callback) {
        req = req.catch((err) => {
            callback(err);
            throw err;
        });
    }
    return req;
}
function pollForNextUpdate(client, tagManager, callback) {
    let req = new Promise((resolve, reject) => {
        let methodName = tagManager ?
            "GetNextUpdateForAllManagersOnDB" :
            "GetNextUpdateForAllManagers";
        let soapMethod = client[methodName];
        let args = {};
        if (tagManager) args.dbid = tagManager.dbid;
        soapMethod(args, function(err, result) {
            if (err) return reject(err);
            let tagDataList = JSON.parse(result[methodName + "Result"]);
            try {
                if (callback) callback(null, { object: tagManager,
                                               value: tagDataList });
            } catch (e) {
                logError(console, e);
                // no good reason to escalate an error thrown by callback
            }
            resolve(tagDataList);
        });
    });
    if (callback) {
        req = req.catch((err) => {
            callback(err);
            throw err;
        });
    }
    return req;
}
function pollForNextUpdate ( client , tagManager , callback ) { let req = new Promise ( ( resolve , reject ) => { let methodName = tagManager ? "GetNextUpdateForAllManagersOnDB" : "GetNextUpdateForAllManagers" ; let soapMethod = client [ methodName ] ; let args = { } ; if ( tagManager ) args . dbid = tagManager . dbid ; soapMethod ( args , function ( err , result ) { if ( err ) return reject ( err ) ; let tagDataList = JSON . parse ( result [ methodName + "Result" ] ) ; try { if ( callback ) callback ( null , { object : tagManager , value : tagDataList } ) ; } catch ( e ) { logError ( console , e ) ; // no good reason to escalate an error thrown by callback } resolve ( tagDataList ) ; } ) ; } ) ; if ( callback ) { req = req . catch ( ( err ) => { callback ( err ) ; throw err ; } ) ; } return req ; }
Polls the API endpoint for available updates and returns them.

@param {object} client - the SOAP client object
@param {WirelessTagManager} [tagManager] - the tag manager to which
to restrict updates
@param {module:wirelesstags~apiCallback} [callback] - if provided,
the `tagManager` parameter must be
provided too (even if as undefined or
null)

@returns {Promise} On success, resolves to an array of tag data objects
@private
Polls the API endpoint for available updates and returns them .