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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -