mirror of
https://github.com/astefanutti/decktape.git
synced 2024-09-11 14:25:44 +03:00
BREAKING CHANGE: Please run node 12.20 or higher BREAKING CHANGE: This package is now a pure esm, please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
35 lines
720 B
JavaScript
35 lines
720 B
JavaScript
export const create = page => new DZSlides(page);
|
|
|
|
class DZSlides {
|
|
|
|
constructor(page) {
|
|
this.page = page;
|
|
}
|
|
|
|
getName() {
|
|
return 'DZ Slides';
|
|
}
|
|
|
|
isActive() {
|
|
return this.page.evaluate(_ => typeof Dz !== 'undefined');
|
|
}
|
|
|
|
slideCount() {
|
|
return this.page.evaluate(_ =>
|
|
Dz.slides.reduce((count, slide) => count + slide.$$('.incremental > *').length + 1, 0));
|
|
}
|
|
|
|
hasNextSlide() {
|
|
return this.page.evaluate(_ => !(Dz.idx == Dz.slides.length
|
|
&& Dz.step == Dz.slides[Dz.idx - 1].$$('.incremental > *').length));
|
|
}
|
|
|
|
nextSlide() {
|
|
return this.page.evaluate(_ => Dz.forward());
|
|
}
|
|
|
|
currentSlideIndex() {
|
|
return this.page.evaluate(_ => Dz.idx + '.' + Dz.step);
|
|
}
|
|
}
|