当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Clock.tick方法代码示例

本文整理汇总了TypeScript中lolex.Clock.tick方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Clock.tick方法的具体用法?TypeScript Clock.tick怎么用?TypeScript Clock.tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lolex.Clock的用法示例。


在下文中一共展示了Clock.tick方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

const skipBattle = (clock: Clock, fsp: FullScreenPokemon, player: IPlayer): void => {
    fsp.inputs.keyDownA(player);
    clock.tick(2000);
    fsp.inputs.keyDownA(player);
    clock.tick(2000);
    fsp.inputs.keyDownA(player);
    fsp.inputs.keyDownA(player);
    clock.tick(2000);
    fsp.inputs.keyDownA(player);
    clock.tick(1000);
};
开发者ID:FullScreenShenanigans,项目名称:FullScreenPokemon,代码行数:11,代码来源:Experience.test.ts

示例2:

const skipBallsFlickering = (clock: Clock, fsp: FullScreenPokemon): void => {
    // Balls slowly appearing
    clock.tick(fsp.cutscenes.pokeCenter.ballAppearanceRate * fsp.frameTicker.getInterval());

    // Balls flickering
    clock.tick(fsp.cutscenes.pokeCenter.ballFlickerRate * fsp.frameTicker.getInterval() * 2);

    // Balls dissapearing after 8 flashes + a double-long pause
    clock.tick(fsp.cutscenes.pokeCenter.ballFlickerRate * fsp.frameTicker.getInterval() * 10);

};
开发者ID:FullScreenShenanigans,项目名称:FullScreenPokemon,代码行数:11,代码来源:PokeCenterCutscene.test.ts

示例3: it

 it("waits the specified number of milliseconds before executing", ()=>{
     let done = false;
     let deb = accumulatingDebounce((x:number)=>{ done = true; }, (x:number)=>0, ()=>{return 0;}, 250);
     deb();
     clock.tick(10);
     assert.isFalse(done);
     clock.tick(60);
     assert.isFalse(done);
     clock.tick(100);
     assert.isFalse(done);
     clock.tick(90);
     assert.isTrue(done);
 });
开发者ID:agarwalrounak,项目名称:cbioportal-frontend,代码行数:13,代码来源:accumulatingDebounce.spec.ts

示例4: assert

         "three times in succession", ()=>{
     let deb:AccumulatingDebouncedFunction<any>;
     let done = false;
     const finalFn = sinon.spy(()=>{
         assert(addFn.callCount === 3, "add function called three times, before the final function called once");
     });
     const addFn = sinon.spy(()=>{ return {}; });
     const afterTimeoutExpire = sinon.spy(()=>{
         if (afterTimeoutExpire.callCount === 1) {
             assert(addFn.callCount === 3, "add function called three times before the first timeout expire");
             assert(deb.isPending(), "final function will be called again, because there has been an add call "+
                                     "(actually, 2) since the timeout was set");
         } else {
             assert(afterTimeoutExpire.callCount === 2, "timeout expired only twice");
             assert(addFn.callCount === 3, "no additional add calls triggered since last timeout expire");
             assert(!deb.isPending(), "final function will not be called again");
             done = true;
         }
     });
     deb = accumulatingDebounce(finalFn, addFn, ()=>{return {};}, 0, afterTimeoutExpire);
     deb();
     deb();
     deb();
     clock.tick(1);
     assert.isTrue(finalFn.calledOnce);
     assert.isTrue(done);
 });
开发者ID:agarwalrounak,项目名称:cbioportal-frontend,代码行数:27,代码来源:accumulatingDebounce.spec.ts

示例5:

const processBattle = (fsp: FullScreenPokemon, enemyPokemon: IPokemon, player: IPlayer, clock: Clock) => {
    fsp.battles.startBattle({
        teams: {
            opponent: {
                actors: [enemyPokemon],
            },
        },
        texts: {
            start: (team: IBattleTeam): string =>
                `Wild ${team.selectedActor.nickname.join("")} appeared!`,
        },
    });
    fsp.inputs.keyDownA(player);
    clock.tick(2000);
};
开发者ID:FullScreenShenanigans,项目名称:FullScreenPokemon,代码行数:15,代码来源:Battles.test.ts


注:本文中的lolex.Clock.tick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。