# three-events

> DOM events via THREE objects

Latest version **1.0.1** (published 2021-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install three-events
pnpm add three-events
yarn add three-events
bun add three-events
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-06-05 |
| First published | 2021-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ildardev |
| Maintainers | ildardev |
| Keywords | THREE, three.js, event, listener, handler, ts, js |

## Links

- npm: https://www.npmjs.com/package/three-events
- Repository: https://github.com/IldarDavletyarov/three-events
- Homepage: https://github.com/IldarDavletyarov/three-events#readme
- Issues: https://github.com/IldarDavletyarov/three-events/issues
- npm.io page: https://npm.io/package/three-events

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-06-05
- 1.0.0 — 2021-03-11
- 0.0.10 — 2021-03-04
- 0.0.9 — 2021-03-04
- 0.0.8 — 2021-03-02
- 0.0.7 — 2021-03-02
- 0.0.6 — 2021-03-02
- 0.0.5 — 2021-03-02
- 0.0.4 — 2021-03-02
- 0.0.3 — 2021-03-01
- 0.0.2 — 2021-03-01
- 0.0.1 — 2021-03-01

## README

# THREE-events
## Install
    npm i three-events
## Import
    import ThreeEvents from 'three-events'
## Initialize (renderer, camera[, recursiveFlag])
    const threeEvents = new ThreeEvents(
        new THREE.WebGLRenderer(),
        new THREE.Camera()
    )
## addEventListener (object | objects, type, callback[, options])
    const geometry = new THREE.BoxGeometry(1, 1, 1)
    const material = new THREE.MeshBasicMaterial({ color: #fff })
    const cube = new THREE.Mesh(geometry, material)
    const handler = (event, object) => { console.log('hello') }
	
    threeEvents.addEventListener(cube, 'mousemove', handler)
##### The callback is called with parameters (event, object)
##### options is for default target.addEventListener(type, listener[, *options*]);    
## removeEventListener (object | objects, type, callback[, options])
##### Works also for anonymous functions!
    threeEvents.removeEventListener(cube, 'mousemove', handler);
###### Removing a listener will only work if the object's IDs are the same as when the listener was added!

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