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
Post a Comment