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)
38 lines
754 B
JavaScript
38 lines
754 B
JavaScript
export const create = page => new WebSlides(page);
|
|
|
|
class WebSlides {
|
|
|
|
constructor(page) {
|
|
this.page = page;
|
|
}
|
|
|
|
getName() {
|
|
return 'WebSlides';
|
|
}
|
|
|
|
configure() {
|
|
return this.page.evaluate(_ => {
|
|
const style = document.createElement('style');
|
|
const css = document.createTextNode('#counter, #navigation {display: none !important}');
|
|
style.appendChild(css);
|
|
document.body.appendChild(style);
|
|
});
|
|
}
|
|
|
|
isActive() {
|
|
return this.page.evaluate(_ => typeof ws === 'object');
|
|
}
|
|
|
|
slideCount() {
|
|
return this.page.evaluate(_ => ws.maxSlide_);
|
|
}
|
|
|
|
nextSlide() {
|
|
return this.page.evaluate(_ => ws.goNext());
|
|
}
|
|
|
|
currentSlideIndex() {
|
|
return this.page.evaluate(_ => ws.currentSlideI_);
|
|
}
|
|
}
|