本文整理匯總了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);
});
});