diff --git a/src/ImageLoader.js b/src/ImageLoader.js index d7dd706..523e318 100644 --- a/src/ImageLoader.js +++ b/src/ImageLoader.js @@ -14,9 +14,11 @@ export default class ImageLoader { cache: ImageCache; logger: Logger; _index: number; + _window: WindowProxy; - constructor(options: Options, logger: Logger) { + constructor(options: Options, logger: Logger, window: WindowProxy) { this.options = options; + this._window = window; this.origin = this.getOrigin(window.location.href); this.cache = {}; this.logger = logger; @@ -70,7 +72,7 @@ export default class ImageLoader { } getOrigin(url: string): string { - const link = this._link || (this._link = document.createElement('a')); + const link = this._link || (this._link = this._window.document.createElement('a')); link.href = url; link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/ return link.protocol + link.hostname + link.port; diff --git a/src/index.js b/src/index.js index 8af8bc3..423e597 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,10 @@ export type Options = { imageTimeout: ?number, proxy: ?string, removeContainer: ?boolean, - type: ?string + scale: number, + type: ?string, + windowWidth: number, + windowHeight: number }; const html2canvas = (element: HTMLElement, config: Options): Promise => { @@ -25,12 +28,6 @@ const html2canvas = (element: HTMLElement, config: Options): Promise