@ch1c0t/web.helpers
v0.1.0
Published
A few functions to create web user intefaces
Downloads
4
Readme
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:
id
: a String, an id existing in the document;view
, which is either of these:- an instance of HTMLElement;
- an Array of HTMLElement instances;
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'