JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 890
  • Score
    100M100P100Q100851F
  • License MIT

Tiny href click handler library

Package Exports

  • nanohref

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nanohref) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nanohref stability

npm version build status downloads js-standard-style

Tiny href click handler library.

Usage

var nanohref = require('nanohref')

nanohref(function (location) {
  console.log('new location is', location.pathname)
})

// Create DOM node
var el = document.createElement('a')
el.setAttribute('href', '/my-link')
el.innerText = 'Click me'
document.body.appendChild(el)

// Trigger click
el.click()
// => "new location is /my-link"

API

nanohref(handler(location), [rootNode])

Create a new anchor click handler. The second argument is for the root node, which defaults to window.document. If the data-no-routing attribute is set, Nanohref will not handle the link. This is useful to link to resources outside the application.

License

MIT