# unipointer

> Do one thing with one pointer

Latest version **2.4.0** (published 2021-12-19) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2021-12-19 |
| First published | 2015-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | David DeSandro |
| Maintainers | desandro |
| Keywords | pointer, touch, mouse, browser, DOM |

## Links

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

## Dependencies (1)

- [ev-emitter](https://npm.io/package/ev-emitter.md) ^1.0.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.4.0 (latest) — 2021-12-19
- 2.3.0 — 2018-03-27
- 2.2.1 — 2017-11-22
- 2.2.0 — 2017-03-16
- 2.1.0 — 2016-01-17
- 2.0.0 — 2016-01-03
- 1.1.0 — 2015-03-07
- 1.0.0 — 2015-02-26
- 0.1.0 — 2015-01-24

## README

# Unipointer

Base class for doing one thing with pointer event

Used with [Unidragger](https://github.com/metafizzy/unidragger) and [TapListener](https://github.com/metafizzy/tap-listener)

## Install

Bower: `bower install unipointer`

npm: `npm install unipointer`

## Usage

``` js
// create new class
function PointerFun( elem ) {
  this.element = elem;
  // binds mousedown/touchstart/pointerdown event
  this._bindStartEvent( this.element, true );
}
// inherit Unipointer
PointerFun.prototype = new Unipointer();

// overwrite public pointer methods
PointerFun.prototype.pointerDown = function( event, pointer ) {
  console.log('pointer down');
};

PointerFun.prototype.pointerMove = function( event, pointer ) {
  console.log('pointer move');
};

PointerFun.prototype.pointerUp = function( event, pointer ) {
  console.log('pointer up');
};

PointerFun.prototype.pointerCancel = function( event, pointer ) {
  console.log('pointer cancel');
};

// triggered on pointerUp and pointerCancel 
PointerFun.prototype.pointerDone = function( event, pointer ) {
  console.log('pointer done');
};
```

---

MIT license

By [Metafizzy](https://metafizzy.co)

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