src/engine.js
/**
   * Captures a screenshot, if enabled
   *
   * @param  {String} mimeType The mime type of the image
   * @param  {Number} quality  Quality, if applicable (applies to image/jpeg)
   * @return {Promise}         A promise that resolves when the screenshot is complete
   */
Captures a screenshot, if enabled
@param  {String} mimeType The mime type of the image
@param  {Number} quality  Quality, if applicable (applies to image/jpeg)
@return {Promise}         A promise that resolves when the screenshot is complete
Captures a screenshot if enabled @param { String } mimeType The mime type of the image @param { Number } quality Quality if applicable ( applies to image / jpeg ) @return { Promise } A promise that resolves when the screenshot is complete
capture(mimeType, quality) {
    if (this.canScreenshot) {
      this.stop();
      let promise = new Promise((resolve, reject) => {
        try {
          this.canvas.toBlob((blob) => {
            resolve(blob);
          }, mimeType, quality);
        } catch (e) {
          reject(e);
        }
      });
      return promise;
    } else {
      return Promise.reject(new Error('Screenshots not enabled.  Initialize engine with `enableSnapshots` and ensure `canvas.toBlob` is supported by your browser.'));
    }
  }
capture ( mimeType , quality ) { if ( this . canScreenshot ) { this . stop ( ) ; let promise = new Promise ( ( resolve , reject ) => { try { this . canvas . toBlob ( ( blob ) => { resolve ( blob ) ; } , mimeType , quality ) ; } catch ( e ) { reject ( e ) ; } } ) ; return promise ; } else { return Promise . reject ( new Error ( 'Screenshots not enabled.  Initialize engine with `enableSnapshots` and ensure `canvas.toBlob` is supported by your browser.' ) ) ; } }
Captures a screenshot, if enabled
 @param  {String} mimeType The mime type of the image
 @param  {Number} quality  Quality, if applicable (applies to image/jpeg)
 @return {Promise}         A promise that resolves when the screenshot is complete
Captures a screenshot if enabled @param { String } mimeType The mime type of the image @param { Number } quality Quality if applicable ( applies to image / jpeg ) @return { Promise } A promise that resolves when the screenshot is complete
// promise.then(() => { //   this.render(); // }, () => { //   this.render(); // });