mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
Use globalThis to reference global scope (#3719)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
23e67eb515
commit
60b53fd6b6
19 changed files with 219 additions and 264 deletions
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { atob } from "./text_encoding.ts";
|
||||
import { TypedArray } from "./types.ts";
|
||||
import { window } from "./window.ts";
|
||||
|
||||
let logDebug = false;
|
||||
let logSource = "JS";
|
||||
|
@ -19,9 +19,9 @@ export function setLogDebug(debug: boolean, source?: string): void {
|
|||
*/
|
||||
export function log(...args: unknown[]): void {
|
||||
if (logDebug) {
|
||||
// if we destructure `console` off `window` too early, we don't bind to
|
||||
// if we destructure `console` off `globalThis` too early, we don't bind to
|
||||
// the right console, therefore we don't log anything out.
|
||||
window.console.log(`DEBUG ${logSource} -`, ...args);
|
||||
globalThis.console.log(`DEBUG ${logSource} -`, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ export function humanFileSize(bytes: number): string {
|
|||
|
||||
// @internal
|
||||
export function base64ToUint8Array(data: string): Uint8Array {
|
||||
const binString = window.atob(data);
|
||||
const binString = atob(data);
|
||||
const size = binString.length;
|
||||
const bytes = new Uint8Array(size);
|
||||
for (let i = 0; i < size; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue