New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

h-spa

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h-spa

Typescript Helpers

latest
npmnpm
Version
0.0.9
Version published
Weekly downloads
7
75%
Maintainers
1
Weekly downloads
 
Created
Source

Incredibly simple single pager router application

will generate a very simple home page

expects an element named content

Usage

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen" href="https://static.jackman.biz/cdn/reset.css" />
</head>
<body>
  <div id="menubar" style="position: fixed;top: 0"><a href="#">[🏠home]</a></div>
  <div id="content"></div>
  <script src="dist/index.js"></script>
  <script src="/rldr"></script>
</body>
</html>
import {router} from "h-spa"

function demo1 (el: HTMLDivElement) => {
  var alive = true
  i = 0
  function loop() {
    el.innerText = `Counter: ${i++}`
    if (alive) requestAnimationFrom(loop)
  }

  requestAnimationFrame(loop)

  function stop() {alive = false}

  return stop
}

function demo2 (el: HTMLDivElement) => {
  el.innerText = "HELLO DEMO 2"
}



router({
  demo1,
  demo2,
})

http://localhost:1234/#demo1
http://localhost:1234/#demo2
http://localhost:1234/#demo3

Keywords

ash9g

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts