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