Improve type checking in WebGL support test
This commit is contained in:
@@ -52,17 +52,21 @@ ol.webgl.getContext = function(canvas, opt_attributes) {
|
|||||||
* @const
|
* @const
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
ol.webgl.SUPPORTED = (function() {
|
ol.webgl.SUPPORTED = (
|
||||||
if (!('WebGLRenderingContext' in goog.global)) {
|
/**
|
||||||
return false;
|
* @return {boolean} WebGL supported.
|
||||||
}
|
*/
|
||||||
try {
|
function() {
|
||||||
var canvas = /** @type {HTMLCanvasElement} */
|
if (!('WebGLRenderingContext' in goog.global)) {
|
||||||
(goog.dom.createElement(goog.dom.TagName.CANVAS));
|
return false;
|
||||||
return !goog.isNull(ol.webgl.getContext(canvas, {
|
}
|
||||||
failIfMajorPerformanceCaveat: true
|
try {
|
||||||
}));
|
var canvas = /** @type {HTMLCanvasElement} */
|
||||||
} catch (e) {
|
(goog.dom.createElement(goog.dom.TagName.CANVAS));
|
||||||
return false;
|
return !goog.isNull(ol.webgl.getContext(canvas, {
|
||||||
}
|
failIfMajorPerformanceCaveat: true
|
||||||
})();
|
}));
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user