'use strict';

var Promise = require('bluebird');

var browserManager = require('./browser.js');


/**
 * Takes an options object liek
 * { url : '', delay : [seconds], width : [size], heihgt :  [size], css : '[custom css]', format : 'png|jpeg' default png };
 * returns a promise
 */
module.exports = function(options){
  return new Promise(function(resolve, reject) {
    browserManager
    .getBrowser()
    .then(function(browser){
      browser
      .screenshot(options)
      .then(resolve)
      .catch(reject);
    })
    .catch(reject);
  });
};

module.exports.close = function(){
  browserManager.close();
};

// Ensure that the Browser instance will be closed on exit
process.on('exit', module.exports.close);

@@ -91,17 +91,16 @@
 .js');%0A%0A
-%0A
 /**%0A * T
@@ -109,166 +109,77 @@
 es a
-n options object liek%0A * %7B url : '', delay : %5Bseconds%5D, width : %5Bsize%5D, heihgt :  %5Bsize%5D, css : '%5Bcustom css%5D', format : 'png%7Cjpeg' default png %7D;
+ screenshot%0A * @param %7BObject%7D options The first number.
 %0A * 
+@
 returns 
 a pr
@@ -178,17 +178,42 @@
 rns 
-a p
+%7BP
 romise
+%7D Resolves to image object
 %0A */
@@ -238,16 +238,17 @@
 function
+ 
 (options
@@ -248,16 +248,17 @@
 options)
+ 
 %7B%0A  retu
@@ -280,16 +280,17 @@
 function
+ 
 (resolve
@@ -356,16 +356,17 @@
 function
+ 
 (browser
@@ -366,16 +366,17 @@
 browser)
+ 
 %7B%0A      
@@ -490,16 +490,64 @@
 %7D);%0A%7D;%0A%0A
+/**%0A * Close the browser%0A * @returns %7Bvoid%7D%0A */%0A
 module.e
@@ -569,18 +569,20 @@
 function
+ 
 ()
+ 
 %7B%0A  brow

Use JSDoc