0.3.2 • Published 4 years ago

@tourepedia/dom-helpers v0.3.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Dom helpers

Install

npm install --save @tourepedia/dom-helpers

Utilities

isDom

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

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

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

activeElement

Return the current active element in the dom

import { activeElement } from "@tourepedia/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 "@tourepedia/dom-helpers"

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

4 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.1.0

5 years ago