本文整理汇总了TypeScript中@daybrush/utils.hasClass函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hasClass函数的具体用法?TypeScript hasClass怎么用?TypeScript hasClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hasClass函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it(`should check playCSS method with iteration count = 2`, done => {
const scene = new Scene({
".test": {
0: {
width: "100px",
height: "100px",
},
0.1: {
width: "200px",
height: "200px",
},
},
"options": {
iterationCount: 2,
selector: true,
},
});
scene.playCSS();
expect(hasClass(document.querySelector(".test1"), START_ANIMATION)).to.be.true;
expect(hasClass(document.querySelector(".test2"), START_ANIMATION)).to.be.true;
expect(scene.getPlayState()).to.be.equals("running");
expect(scene.state.playCSS).to.be.true;
const spy = sinon.spy();
scene.on("iteration", spy);
scene.on("ended", e => {
expect(spy.calledOnce).to.be.true;
expect(scene.getPlayState()).to.be.equals("paused");
expect(scene.state.playCSS).to.be.false;
done();
});
});
示例2: addEvent
addEvent(navButon, "click", () => {
if (hasClass(body, "navigate")) {
exitNav();
} else {
enterNav();
}
});
示例3: enterNav
function enterNav() {
if (hasClass(body, "navigate") || (navScene.getPlayState() === "running" && navScene.getDirection() === "normal")) {
return;
}
addClass(body, "navigate");
navScene.pause();
navScene.setPlaySpeed(1);
navScene.setDirection("normal");
navScene.setTime(0);
navScene.play();
}
示例4: exitNav
function exitNav() {
if (!hasClass(body, "navigate") ||
(navScene.getPlayState() === "running" && navScene.getDirection() === "reverse")) {
return;
}
removeClass(body, "navigate");
navScene.pause();
navScene.setPlaySpeed(1.5);
navScene.setDirection("reverse");
navScene.setTime(0);
navScene.play();
}