本文整理汇总了TypeScript中delay.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('socket timeout is canceled on error', withServer, async (t, server, got) => {
server.get('/', defaultHandler);
const message = 'oh, snap!';
const promise = got({
timeout: {socket: 100},
retry: 0
}).on('request', request => {
request.emit('error', new Error(message));
request.abort();
});
await t.throwsAsync(promise, {message});
// Wait a bit more to check if there are any unhandled errors
await delay(100);
});
开发者ID:sindresorhus,项目名称:got,代码行数:18,代码来源:timeout.ts
示例2: delay
_.each(arr, async function(newData, i, arr) {
if (i > 0) {
let previousIndex = i - 1
let previousData = arr[previousIndex]
let d = (newData.prdt - previousData.prdt) * 1000
dly = dly + d
await delay(dly)
}
ws.send(JSON.stringify(newData))
});
开发者ID:open-cta,项目名称:wss-api,代码行数:10,代码来源:app.ts
示例3: delay
test('no more timeouts after an error', async t => {
await t.throwsAsync(got(`http://${Date.now()}.dev`, {
retry: 1,
timeout: {
lookup: 1,
connect: 1,
secureConnect: 1,
socket: 1,
response: 1,
send: 1,
request: 1
}
}), {instanceOf: got.GotError}); // Don't check the message, because it may throw ENOTFOUND before the timeout.
// Wait a bit more to check if there are any unhandled errors
await delay(100);
});
开发者ID:sindresorhus,项目名称:got,代码行数:17,代码来源:timeout.ts
示例4: delay
test('no unhandled errors', async t => {
const server = net.createServer(connection => {
connection.end('blah');
}).listen(0);
const message = 'snap!';
const options = {
cookieJar: {
setCookie: () => {},
getCookieString: (_, __, cb) => cb(new Error(message))
}
};
await t.throwsAsync(got(`http://127.0.0.1:${(server.address() as AddressInfo).port}`, options), {message});
await delay(500);
t.pass();
server.close();
});
开发者ID:sindresorhus,项目名称:got,代码行数:20,代码来源:cookies.ts
示例5: delay
async options => {
await delay(100);
options.headers.foo = 'bar';
}
开发者ID:sindresorhus,项目名称:got,代码行数:4,代码来源:hooks.ts
示例6: delay
.catch((e: Error) => {
spinner.fail(e.message)
return delay(1000).then(() => randomEbayResult())
})
开发者ID:crooked-ventures,项目名称:literally.deals,代码行数:4,代码来源:random-ebay-result.ts
示例7: delay
it('counts the time', async function() {
const counter = new StatsCounter()
await delay(1)
expect(counter.duration()).to.match(/\d+.s/)
})
开发者ID:Originate,项目名称:tutorial-runner,代码行数:5,代码来源:stats-counter-test.ts
注:本文中的delay.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论