How to include multiple JavaScript libs in PhantomJS? -
i'm using phantomjs generate series of images based on state of html canvas element manipulating via js. canvas manipulation depends on 3 separate js libraries , inline scripts invoke during window.onload.
the phantomjs docs cover how include single js library, doesn't cover how include several.
can provide me correct syntax include several js libs, , run scripts during window.onload?
there callback page.includejs(). when first 1 done, can load next one. done recursively.
function multipleincludejs(page, jsarray, done) { if (jsarray.length === 0) { done(); return; } var url = jsarray.shift(); page.includejs(url, function(){ multipleincludejs(page, jsarray, done); }); } and use this:
multipleincludejs(page, ["http://code.jquery...", "http://getbootstrap..."], function(){ console.log("loaded"); });
Comments
Post a Comment