@gladio/dom-helpers
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

Dom helpers

Install

npm install --save @gladio/dom-helpers

Utilities

isDom

check if dom is available (generally used in univeral apps)

import { isDom } from "@gladio/dom-helpers"

function App() {
  if (isDom) {
    // rendering in a browser
  }
}

activeElement

Return the current active element in the dom

import { activeElement } from "@gladio/dom-helpers"

const App () {
  const currentActiveElement = activeElement()
}

contains

Checks whether or not a dom node is contains another given dom node. An usecase would be for checking a active element inside a container

import { contains } from "@gladio/dom-helpers"

function App() {
  // after mount
  if (contains(container, child)) {
    // do something with it
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @gladio/dom-helpers

Weekly Downloads

1

Version

0.5.1

License

MIT

Unpacked Size

19.6 kB

Total Files

9

Last publish

Collaborators

  • sudkumar