Published
Edited
Sep 4, 2020
Importers
Insert cell
Insert cell
Insert cell
gl = {
var gl;
const canvas = document.createElement('canvas');
try { gl = canvas.getContext("webgl"); }
catch (x) { gl = null; }

if (gl == null) {
try { gl = canvas.getContext("experimental-webgl"); }
catch (x) { gl = null; }
}
return gl;
}
Insert cell
webgl_supported = gl ? true : false
Insert cell
function extension_available(extension_string) {
if (webgl_supported) {
return gl.getSupportedExtensions().includes(extension_string)
}
}
Insert cell
mutable has_webgl_context = true;
Insert cell
function add_context_listener(gl) {
gl.canvas.addEventListener("webglcontextlost", (e) => {
mutable has_webgl_context = false;
}, false);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more