diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index b8c960edda..576e9192c2 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -507,7 +507,7 @@ PluggableMap.prototype.disposeInternal = function() { unlisten(this.viewport_, EventType.MOUSEWHEEL, this.handleBrowserEvent, this); if (this.handleResize_ !== undefined) { - window.removeEventListener(EventType.RESIZE, + removeEventListener(EventType.RESIZE, this.handleResize_, false); this.handleResize_ = undefined; } @@ -1010,7 +1010,7 @@ PluggableMap.prototype.handleTargetChanged_ = function() { this.renderer_.removeLayerRenderers(); removeNode(this.viewport_); if (this.handleResize_ !== undefined) { - window.removeEventListener(EventType.RESIZE, + removeEventListener(EventType.RESIZE, this.handleResize_, false); this.handleResize_ = undefined; } @@ -1028,7 +1028,7 @@ PluggableMap.prototype.handleTargetChanged_ = function() { if (!this.handleResize_) { this.handleResize_ = this.updateSize.bind(this); - window.addEventListener(EventType.RESIZE, + addEventListener(EventType.RESIZE, this.handleResize_, false); } } diff --git a/src/ol/index.js b/src/ol/index.js index 9c7c3e603a..5ba16dda4d 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -41,7 +41,7 @@ let WEBGL_EXTENSIONS; // value is set below let HAS_WEBGL = false; -if ('WebGLRenderingContext' in window) { +if (typeof window !== 'undefined' && 'WebGLRenderingContext' in window) { try { const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('CANVAS')); const gl = getContext(canvas, {failIfMajorPerformanceCaveat: true}); diff --git a/src/ol/render/canvas.js b/src/ol/render/canvas.js index b0c94f6ba4..98734a9659 100644 --- a/src/ol/render/canvas.js +++ b/src/ol/render/canvas.js @@ -167,7 +167,7 @@ export const checkFont = (function() { } } if (done) { - window.clearInterval(interval); + clearInterval(interval); interval = undefined; } } @@ -184,7 +184,7 @@ export const checkFont = (function() { if (!isAvailable(fontFamily)) { checked[fontFamily] = 0; if (interval === undefined) { - interval = window.setInterval(check, 32); + interval = setInterval(check, 32); } } }