Skip to content

Commit

Permalink
phantomjs delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ondras committed May 30, 2014
1 parent 3b290f1 commit da95856
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/phantomjs-my-mind.js
Expand Up @@ -30,6 +30,7 @@ if (dataSource) {
var page = require("webpage").create();
page.onAlert = function(msg) { console.log(msg); }
page.open(url, function() {
setTimeout(function() {
page.evaluate(function(dataSource, data) {
/* switch to print mode */
document.querySelector("link[media~=print]").media = "all";
Expand Down Expand Up @@ -58,4 +59,5 @@ page.open(url, function() {

page.render(output);
phantom.exit();
}, 500); /* wait a bit. there is a mysterious race somewhere causing phantom to be too fast otherwise. */
});

0 comments on commit da95856

Please sign in to comment.