本文整理匯總了TypeScript中agenda.Job類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Job類的具體用法?TypeScript Job怎麽用?TypeScript Job使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Job類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('it understands human intervals', () => {
let now = new Date();
job.attrs.lastRunAt = now;
job.repeatEvery('2 minutes');
job.computeNextRunAt();
expect(job.attrs.nextRunAt).to.be(now.valueOf() + 120000);
});
示例2: beforeEach
beforeEach(() => {
try {
job.attrs.repeatInterval = 'asd';
job.computeNextRunAt();
}
catch (e) {}
});
示例3: done
job.save((err) => {
if (err) {
return done(err);
}
jobs.define('failBoat3', (job, cb) => {
// Explicitly find the job again,
// so we have a new job object
jobs.jobs({ name: 'failBoat3' }, (err, j) => {
if (err) {
return done(err);
}
j[0].remove((err) => {
if (err) {
return done(err);
}
cb();
});
});
});
job.run(() => {
// Expect the deleted job to not exist in the database
jobs.jobs({ name: 'failBoat3' }, (err, j) => {
if (err) {
return done(err);
}
expect(j).to.have.length(0);
done();
});
});
});