Skip to content

Commit

Permalink
Merge pull request astefanutti#132 from wwoods/master
Browse files Browse the repository at this point in the history
Allow CSS media type to be specified on command line
  • Loading branch information
astefanutti authored Feb 12, 2018
2 parents 5669c5d + 21ea14a commit e54f32c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
const { pause } = require('../libs/util');

exports.options = {
media: {
default : 'screen',
choices : ['screen', 'print'],
metavar : '<media>',
help : "'print' or 'screen' to set CSS media type",
},
key : {
default : 'ArrowRight',
metavar : '<key>',
Expand Down Expand Up @@ -34,6 +40,7 @@ class Generic {
this.currentSlide = 1;
this.isNextSlideDetected = false;
this.key = this.options.key || exports.options.key.default;
this.media = this.options.media || exports.options.media.default;
}

getName() {
Expand All @@ -45,6 +52,7 @@ class Generic {
}

async configure() {
await this.page.emulateMedia(this.media);
await this.page.exposeFunction('onMutation', _ => (this.isNextSlideDetected = true));
await this.page.evaluate(_ =>
new MutationObserver(_ => window.onMutation()).observe(document, {
Expand Down

0 comments on commit e54f32c

Please sign in to comment.