Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return sinon.spy(() => {
const self = this;
return Q.delay(time).then(() => { return f.apply(self, []); });
});
}
browserAgent.on(RunnerEvents.SESSION_START, (browser) => {
return q.delay(1).then(() => browser.foo = 'bar');
});
.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) {
getElements() {
return Q.delay(10).then(() => <div>foo</div>);
}
}
_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,
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());
}
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);
};
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);
.catch(function (error) {
if (--repeats === 0) throw error;
return q.delay(delay).then(next);
});
})();