-
Notifications
You must be signed in to change notification settings - Fork 176
/
impress.js
37 lines (30 loc) · 784 Bytes
/
impress.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export const create = page => new Impress(page);
class Impress {
constructor(page) {
this.page = page;
}
getName() {
return 'Impress JS';
}
isActive() {
return this.page.evaluate(_ => {
if (typeof impress === 'function') {
return true;
}
if (document.getElementById('impress')) {
console.log('Impress JS plugin isn\'t compatible with impress.js version < 0.3.0');
}
return false;
});
}
slideCount() {
return this.page.evaluate(_ =>
document.querySelectorAll('#impress .step, #impress .substep').length);
}
nextSlide() {
return this.page.evaluate(_ => impress().next());
}
currentSlideIndex() {
return this.page.evaluate(_ => window.location.hash.replace(/^#\/?/, ''));
}
}