UNPKG

@itwin/frontend-devtools

Version:

Debug menu and supporting UI widgets

31 lines 1.74 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.ReportWebGLCompatibilityTool = void 0; /** @packageDocumentation * @module Tools */ const core_frontend_1 = require("@itwin/core-frontend"); /** Queries the client's level of compatibility with the rendering system and outputs it to NotificationManager. * @beta */ class ReportWebGLCompatibilityTool extends core_frontend_1.Tool { static toolId = "ReportWebGLCompatibility"; async run(_args) { const info = core_frontend_1.IModelApp.queryRenderCompatibility(); const statuses = ["OK", "Missing Optional Features", "Major Performance Caveat", "Missing Required Features", "Failed to Create Context"]; const status = info.status < statuses.length ? statuses[info.status] : "UNKNOWN"; const json = JSON.stringify(info, null, 2); // prettify JSON output const msg = `Compatibility: ${status}\n${json}`; const html = document.createElement("div"); html.style.whiteSpace = "pre-wrap"; html.appendChild(document.createTextNode(msg)); await core_frontend_1.IModelApp.notifications.openMessageBox(core_frontend_1.MessageBoxType.Ok, html, core_frontend_1.MessageBoxIconType.Information); return true; } } exports.ReportWebGLCompatibilityTool = ReportWebGLCompatibilityTool; //# sourceMappingURL=ReportWebGLCompatibilityTool.js.map