MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / Environment

Class Environment

packages/alphatab/src/Environment.ts:133–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 * @public
132 */
133export class Environment {
134 /**
135 * The scaling factor to use when rending raster graphics for sharper rendering on high-dpi displays.
136 * @internal
137 */
138 public static highDpiFactor = 1;
139
140 /**
141 * @target web
142 */
143 private static _globalThis: any | undefined = undefined;
144
145 /**
146 * @target web
147 * @internal
148 */
149 public static get globalThis(): any {
150 if (Environment._globalThis === undefined) {
151 try {
152 Environment._globalThis = globalThis;
153 } catch {
154 // globalThis not available
155 }
156
157 if (typeof Environment._globalThis === 'undefined') {
158 Environment._globalThis = self;
159 }
160 if (typeof Environment._globalThis === 'undefined') {
161 Environment._globalThis = global;
162 }
163 if (typeof Environment._globalThis === 'undefined') {
164 Environment._globalThis = window;
165 }
166 if (typeof Environment._globalThis === 'undefined') {
167 Environment._globalThis = Function('return this')();
168 }
169 }
170
171 return Environment._globalThis;
172 }
173
174 /**
175 * @target web
176 * @internal
177 * @partial
178 */
179 public static getGlobalWorkerScope<T>(): IAlphaTabWorkerGlobalScope<T> {
180 return Environment.globalThis;
181 }
182
183 /**
184 * @target web
185 */
186 public static readonly webPlatform: WebPlatform = Environment._detectWebPlatform();
187
188 /**
189 * @target web
190 */

Callers

nothing calls this directly

Calls 8

_detectWebPlatformMethod · 0.80
_detectWebPackMethod · 0.80
_detectViteMethod · 0.80
_detectScriptFileMethod · 0.80
_detectFontDirectoryMethod · 0.80

Tested by

no test coverage detected