title: Phantom.js - How to use promises instead of callbacks?
body: <p>I am testing <code>phantom-node</code> with this code:</p>
  
  <pre><code>var http = require('http');
  http.createServer(function (req, res) {
    res.write('&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;');
    res.write('&lt;p&gt;Write your HTML content here&lt;/p&gt;');
    res.end('&lt;/body&gt;&lt;/html&gt;');
  }).listen(1337);
  
  var phantomProxy = require('phantom-proxy');
  
  phantomProxy.create({'debug': true}, function (proxy) {
      proxy.page.open('http://localhost:1337', function (result) {
          proxy.page.render('scratch.png', function (result) {
                  proxy.end(function () {
                      console.log('done');
                  });
          }, 1000);
      });
  });
  </code></pre>
  
  <p>It works, but I want to change it to something like:</p>
  
  <pre><code>phantomProxy.create()
     .then(something)=&gt;{...}
     .then(something)=&gt;{...}
     .then(something)=&gt;{...}
     .catch((err)=&gt;{
          console.log(err);
          proxy.end();
      }
  </code></pre>
  
  <p>So that it is easier to read. Any suggestion?</p>