26 lines
717 B
Markdown
Raw Permalink Normal View History

2025-04-19 15:38:48 +08:00
# window-getters [![npm version](https://badge.fury.io/js/window-getters.svg)](https://badge.fury.io/js/window-getters)
Safe Window Getters
## API
```typescript
function getFromWindow<T>(name: string): T | undefined;
function getFromWindowOrThrow<T>(name: string): T;
function getDocumentOrThrow(): Document;
function getDocument(): Document | undefined;
function getNavigatorOrThrow(): Navigator;
function getNavigator(): Navigator | undefined;
function getLocationOrThrow(): Location;
function getLocation(): Location | undefined;
function getCryptoOrThrow(): Crypto;
function getCrypto(): Crypto | undefined;
function getLocalStorageOrThrow(): Storage;
function getLocalStorage(): Storage | undefined;
```