UNPKG

orvex

Version:

A lightweight TypeScript library to create and manipulate HTML elements with ease.

75 lines (56 loc) 1.37 kB
# orvex ### Version 1.1.1 **No npm installation required works directly via CDN** --- ## Update - bug fix --- ## install(Not required) ```bash $ npm install orvex ``` --- ## using: #### index.html ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script type="module" src="app.js"></script> </body> </html> ``` #### app.js ```js import * as orvex from "https://cdn.jsdelivr.net/npm/orvex@latest/+esm" // or "https://cdn.jsdelivr.net/npm/orvex@{version}/+esm" //No need to install orvex //and no need to npm let count = 0 const h1 = orvex.mkobj("h1", `Your count: ${count}`) const upButton = orvex.mkobj("button", "increase") const downButton = orvex.mkobj("button", "decrease") orvex.event(upButton, (e) => { if (e.shiftKey) count += 10 else count++ if (count > 255) { alert("It cannot go above 255.") count = 255 } orvex.text(h1, `Your count: ${count}`) }, "click") orvex.event(downButton, (e) => { if (e.shiftKey) count -= 10 else count-- if (count < 0) { alert("It cannot go below 0.") count = 0 } orvex.text(h1, `Your count: ${count}`) }, "click") ```