Support

check your browser or server or phone support global variables.

Usage

  1. You can import in your js file es6 (modules,vue,react,...)
import { WINDOW } from 'helping-js/core/safe-types'

console.log(WINDOW) //{all data in window object OR empty object(if not support window)}
  1. You can import in your js file es5 (nodejs)
var { WINDOW } = require('helping-js/core/safe-types')

console.log(WINDOW) // //{all data in window object OR empty object(if not support window)}
  1. You can usage from CDN (only modules)
import { WINDOW } from 'https://unpkg.com/browse/helping-js/core/safe-types.js'

console.log(WINDOW) // //{all data in window object OR empty object(if not support window)}

Options

FunctionsDescription
WINDOWsafe call to window object (doesn't throw an error if the window doesn't exist)
DOCUMENTsafe call to document object (doesn't throw an error if the document doesn't exist)
NAVIGATORsafe call to navigator object (doesn't throw an error if the navigator doesn't exist)
USER_AGENTsafe call to navigator.userAgent object (doesn't throw an error if the userAgent doesn't exist)
Elementsafe call to Element object (doesn't throw an error if the window doesn't exist)
HTMLElementsafe call to HTMLElement object (doesn't throw an error if the window doesn't exist)
SVGElementsafe call to SVGElement object (doesn't throw an error if the window doesn't exist)
Filesafe call to File object (doesn't throw an error if the window doesn't exist)
Last Updated:
Contributors: parsa jiravand