-
-
Save yorickpeterse/d2d08b59d1323d769e08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global require: true, console: true, phantom: true, ReportsDaemon: true */ | |
(function() { | |
'use strict'; | |
var page = require('webpage').create(); | |
var system = require('system'); | |
var url = system.args[1]; | |
var in_queue = function(page) { | |
return page.evaluate(function() { | |
return ReportsDaemon.Vega.in_queue; | |
}); | |
}; | |
page.viewportSize = {width: 1000, height: 1000}; | |
page.open(url, function (status) { | |
if ( status === 'success' ) { | |
// Wait for Vega to finish rendering everything. | |
setInterval(function() { | |
if ( in_queue(page) === 0 ) { | |
console.log(page.content); | |
phantom.exit(0); | |
} | |
}, 10); | |
} | |
else { | |
system.stderr.write('Failed to open URL ' + url + "\n"); | |
phantom.exit(1); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment