Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.1 KB

dom_global_native_readme.md

File metadata and controls

32 lines (21 loc) · 1.1 KB

Overview

dom_global_native.mjs simply exports global = globalThis. It's a counterpart to dom_global_shim. When writing code to run in both non-DOM and DOM environments, configure your bundler or importmap to import dom_global_shim in non-browsers, and dom_global_native in browsers.

In code intended only for browsers, simply use DOM globals. In code intended only for Deno or Node, simply import dom_global_shim.

TOC

Usage

/*
Use a bundler or importmap to alias this import to one of:
  https://cdn.jsdelivr.net/npm/@mitranim/[email protected]/dom_global_native.mjs
  https://cdn.jsdelivr.net/npm/@mitranim/[email protected]/dom_global_shim.mjs
*/
import * as dg from 'dom_global'

console.log(dg.global)

API

Undocumented

The following APIs are exported but undocumented. Check dom_global_native.mjs.