How to use the q.delay function in q

To help you get started, we’ve selected a few q examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / ghcrawler / test / unit / requestTrackerTests.js View on Github external
return sinon.spy(() => {
    const self = this;
    return Q.delay(time).then(() => { return f.apply(self, []); });
  });
}
github gemini-testing / hermione / test / lib / browser-agent.js View on Github external
browserAgent.on(RunnerEvents.SESSION_START, (browser) => {
                return q.delay(1).then(() => browser.foo = 'bar');
            });
github BitGo / BitGoJS / test / integration / wallets.ts View on Github external
.then(function(result) {
        result.should.have.property('tx');
        result.should.have.property('hash');
        result.should.have.property('fee');
        return Q.delay(3500)
        .then(function() {
          return testWallet.get();
        });
      })
      .then(function(wallet) {
github stanford-oval / almond-cloud / scripts / deps / schema_retriever.js View on Github external
_ensureSchemaRequest() {
        if (this._schemaRequest !== null)
            return;

        this._schemaRequest = Q.delay(0).then(() => {
            var pending = this._pendingSchemaRequests;
            this._pendingSchemaRequests = [];
            this._schemaRequest = null;
            if (pending.length === 0)
                return {};
            if (!this._silent)
                console.log('Batched schema request for ' + pending);
            return schema.getDeveloperMetas(this._dbClient, pending, this._language);
        }).then((rows) => {
            rows.forEach((row) => {
                this._parseSchemaTypes(row, row.triggers);
                this._parseSchemaTypes(row, row.actions);
                this._parseSchemaTypes(row, row.queries);
                this._cache[row.kind] = {
                    triggers: row.triggers,
                    actions: row.actions,
github guptag / FinCharts / legacy / controls / chartpreview.js View on Github external
window.setTimeout(function () {
            if (previewState !== "play") {
                return;
            }

            console.log(currentIndex, self.data.series.length)
            if (currentIndex >= self.data.series.length) {
                self.onPreviewComplete();
                currentIndex = 0;
            } else {
                slidePreview();
                Q.delay(0).then(function () {
                    currentIndex+=1;
                    configureAnimate();
                });
            }
        }, self.timerCb());
    }
github axemclion / browser-perf / lib / probes / SampleProbe.js View on Github external
SampleProbe.prototype.start = function(cfg, browser) {
	debug('start');
	var me = this;
	this.timerHandle = setInterval(function() {
		debug('Event fired');
		me.emit('data', {
			time: new Date().getTime()
		});
	});
	return Q.delay(1);
};
github prozacchiwawa / elm-basic-compile / js / github-source.js View on Github external
function promiseOneObject(url,api,headers) {
    var curTime = (new Date()).getTime();
    if (api && lastRequest + requestInterval > curTime) {
        return q.delay(lastRequest + requestInterval - curTime).then(function() {
            return promiseOneObject(url,api,headers);
        });
    }
    lastRequest = curTime;
    var d = q.defer();
    var request = new XMLHttpRequest();
    request.addEventListener('error', function() {
        console.error(request.status,request.responseText);
        d.reject({status: request.status, text: "could not load " + name});
    });
    request.addEventListener('load', function() {
        if (request.status != 200) {
            console.error("Error", request.status,request.responseText, url);
            d.reject({status: request.status, text: request.responseText});
        } else {
            console.log("Success", url);
github LinkedDataFragments / Client.js / lib / HttpFetcher.js View on Github external
.catch(function (error) {
          if (--repeats === 0) throw error;
          return q.delay(delay).then(next);
        });
    })();