0.1.0 • Published 3 years ago

@ch1c0t/web.helpers v0.1.0

Weekly downloads
-
License
0BSD
Repository
github
Last release
3 years ago

Introduction

web.helpers are a few functions to create web user interfaces. To install:

npm install @ch1c0t/web.helpers

render

To import:

import { render } from '@ch1c0t/web.helpers'

render accepts two arguments:

Usage examples:

div = document.createElement 'div'
render 'SomeId', div

array = [
  document.createElement 'div'
  document.createElement 'div'
]
render 'AnotherId', array

render updates an element at id with Element.replaceChildren.

One way to create elements is with web.tags.

isMobile

is to check if you are in a mobile browser:

import { isMobile } from '@ch1c0t/web.helpers'

if isMobile()
  console.log 'inside of a mobile browser'
else
  console.log 'otherwise'