本文整理汇总了TypeScript中tns-core-modules/timer.clearTimeout函数的典型用法代码示例。如果您正苦于以下问题:TypeScript clearTimeout函数的具体用法?TypeScript clearTimeout怎么用?TypeScript clearTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearTimeout函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test_clearTimeout_multipleTimes_afterTick
export function test_clearTimeout_multipleTimes_afterTick() {
let completed = false;
const id = timer.setTimeout(() => {
completed = true;
});
TKUnit.waitUntilReady(() => completed, 0.5);
TKUnit.assert(completed, "Callback should be called");
timer.clearTimeout(id);
timer.clearTimeout(id);
}
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:13,代码来源:timer-tests.ts
示例2: test_setTimeout_shouldReturnNumber
export function test_setTimeout_shouldReturnNumber() {
let id = timer.setTimeout(() => {
//
});
timer.clearTimeout(id);
TKUnit.assertTrue(typeof id === "number", "Callback should return number!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:7,代码来源:timer-tests.ts
示例3: test_setTimeout_callbackNotCalled
export function test_setTimeout_callbackNotCalled() {
let completed = false;
const id = timer.setTimeout(() => completed = true, 10);
timer.clearTimeout(id);
TKUnit.wait(30 / 1000);
TKUnit.assert(!completed, "Callback should not be called after the specified time!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:9,代码来源:timer-tests.ts
示例4: test_setTimeout_callbackShouldBeCleared
export function test_setTimeout_callbackShouldBeCleared() {
let completed = false;
// >> timer-set-fifty
const id = timer.setTimeout(() => {
// >> (hide)
completed = true;
// << (hide)
}, 50);
//// Clear timeout with specified id.
timer.clearTimeout(id);
// << timer-set-fifty
TKUnit.wait(0.060);
timer.clearTimeout(id);
TKUnit.assert(!completed, "Callback should be cleared when clearTimeout() is executed for specified id!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:19,代码来源:timer-tests.ts
示例5: test_clearTimeout_immediatelyAfterCreate
export function test_clearTimeout_immediatelyAfterCreate() {
let completed = false;
const id = timer.setTimeout(() => {
completed = true;
});
timer.clearTimeout(id);
TKUnit.wait(0.02);
TKUnit.assert(!completed, "Callback should not be called");
}
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:11,代码来源:timer-tests.ts
示例6: test_setTimeout_callbackCalledAfterSpecifiedTime
export function test_setTimeout_callbackCalledAfterSpecifiedTime() {
let completed = false;
// >> timer-set-ten
const id = timer.setTimeout(() => {
// >> (hide)
completed = true;
// << (hide)
}, 10);
// << timer-set-ten
TKUnit.waitUntilReady(() => completed, 1);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback should be called after the specified time!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:15,代码来源:timer-tests.ts
示例7: test_setTimeout
export function test_setTimeout() {
let completed: boolean;
// >> timer-set-zero
const id = timer.setTimeout(() => {
// >> (hide)
completed = true;
// << (hide)
});
// << timer-set-zero
TKUnit.waitUntilReady(() => completed, 0.5, false);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback should be called!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:15,代码来源:timer-tests.ts
示例8: test_setTimeout_extraArgs
export function test_setTimeout_extraArgs() {
let completed: boolean;
let rnd: number = Math.random();
// >> timer-set-zero-args
const id = timer.setTimeout((arg) => {
// >> (hide)
completed = rnd === arg;
// << (hide)
}, 0, rnd);
// << timer-set-zero-args
TKUnit.waitUntilReady(() => completed, 0.5, false);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback called with expected argument!");
};
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:16,代码来源:timer-tests.ts
示例9:
let id = timer.setTimeout(() => {
completed = true;
timer.clearTimeout(id);
});
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:4,代码来源:timer-tests.ts
注:本文中的tns-core-modules/timer.clearTimeout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论