# poniter

> A pointer event router with helper functions for positioning.

Latest version **0.4.0** (published 2015-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install poniter
pnpm add poniter
yarn add poniter
bun add poniter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2015-06-08 |
| First published | 2015-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Stuart P. Bentley |
| Maintainers | stuartpb |
| Keywords | pointer, touch, mouse, event |

## Links

- npm: https://www.npmjs.com/package/poniter
- Repository: https://github.com/stuartpb/poniter
- Issues: https://github.com/stuartpb/poniter/issues
- npm.io page: https://npm.io/package/poniter

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.4.0 (latest) — 2015-06-08
- 0.3.1 — 2015-05-13
- 0.3.0 — 2015-05-13
- 0.2.1 — 2015-05-13
- 0.2.0 — 2015-05-13
- 0.1.0 — 2015-05-13

## README

# poniter

Poniter is a UI library that implements lightweight, emphemeral routers for
pointers (mouse, touch, and stylus events).

## Requirements

Poniter expects the following features in the environment, which will need
to be polyfilled:

- ES6 Maps
- Pointer Events

Also note that, to get pointer events for touches, you will need to set
"touch-action" to "none" (either as a style or as an attribute, depending on
the way your polyfill works) on `<html>`, `<body>`, or any element you want
touch events to start from.

## Listening

To listen for poniter-enhanced pointer events, call `poniter.listen` with the
element you wish to listen to, then call ".on" methods for respective pointer
events:

```js
/*global poniter*/
poniter.listen(document.getElementById('example'))
  .on('enter', function(evt) {
    console.log('new pointer over example element');
  })
  .on('down', function(evt) {
    console.log('example element tapped');
  })
```

Any event can also listen to further events from the given pointer by using the
`pon` method of the event (you may wish to combine this with
`setPointerCapture`) - each `pon` call returns the original event, so multiple
`pon` calls may be chained:

```js
poniter.listen(document.getElementById('example'))
  .on('down', function(evt) {
    var downtime = Date.now();
    evt.target.setPointerCapture(evt.pointerId);
    evt.pon('up', function(evt) {
      var duration = (Date.now() - downtime) / 1000;
      console.log('Pointer dropped after ' + duration + ' seconds');
    }).pon('cancel',function(evt) {
      var duration = (Date.now() - downtime) / 1000;
      console.log('Pointer canceled after ' + duration + ' seconds');
    });
  });
```

## [License in Three Lines ![(LITL)](https://litl-license.org/logo.svg)][LITL]

[LITL]: https://litl-license.org

Copyright 2015 Stuart P. Bentley.<br>
This work may be used freely as long as this notice is included.<br>
The work is provided "as is" without warranty, express or implied.

---
_Source: https://npm.io/package/poniter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
