javascript - Promisify PhantomJS page method? -


i'm trying use bluebird promisify phantomjs method:

page = require('webpage').create(); var checkwebpage = promise.promisify(page.evaluate(function () {          // thing   }));  checkwebpage().then(function(result) {   return result; }); 

however i'm getting following error:

phantom error: typeerror: fn must function 

promisify takes function argument, you're giving return value of function evaluated in context of page object. wrap argument in function if mean evaluate initial function within page, if not, pass function in is.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -