本文整理汇总了TypeScript中@jupyterlab/coreutils.Poll类的典型用法代码示例。如果您正苦于以下问题:TypeScript Poll类的具体用法?TypeScript Poll怎么用?TypeScript Poll使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Poll类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should be set to value passed in during instantation', () => {
const factory = () => Promise.resolve();
const name = '@jupyterlab/test-coreutils:Poll#name-1';
poll = new Poll({ factory, name });
expect(poll.name).to.equal(name);
poll.dispose();
});
示例2: describe
describe('#dispose()', () => {
let poll: Poll;
afterEach(() => {
poll.dispose();
});
it('should dispose the poll and be safe to call repeatedly', async () => {
let rejected = false;
let tick: Promise<IPoll>;
poll = new Poll({
name: '@jupyterlab/test-coreutils:Poll#dispose()-1',
factory: () => Promise.resolve()
});
tick = poll.tick;
expect(poll.isDisposed).to.equal(false);
poll.dispose();
expect(poll.isDisposed).to.equal(true);
try {
await tick;
} catch (error) {
rejected = true;
}
poll.dispose();
expect(rejected).to.equal(true);
});
});