# call-func

> call function

Latest version **0.5.3** (published 2025-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install call-func
pnpm add call-func
yarn add call-func
bun add call-func
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.5.3 |
| Published | 2025-01-20 |
| First published | 2019-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 28.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Hill |
| Maintainers | hillliu |
| Keywords | call-function, dom-event-wrapper |

## Links

- npm: https://www.npmjs.com/package/call-func
- Repository: https://github.com/react-atomic/react-atomic-organism
- Homepage: https://github.com/react-atomic/react-atomic-organism/tree/main/packages/lib/call-func
- Issues: https://github.com/react-atomic/react-atomic-organism/issues
- npm.io page: https://npm.io/package/call-func

## Dependencies (2)

- [reshow-runtime](https://npm.io/package/reshow-runtime.md) *
- [reshow-constant](https://npm.io/package/reshow-constant.md) *

## 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.5.3 (latest) — 2025-01-20
- 0.5.2 — 2025-01-20
- 0.5.0 — 2025-01-17
- 0.4.0 — 2024-06-22
- 0.3.12 — 2024-06-21
- 0.3.11 — 2024-06-21
- 0.3.10 — 2024-06-21
- 0.3.9 — 2023-10-30
- 0.3.8 — 2023-08-03
- 0.3.7 — 2023-08-03
- 0.3.6 — 2022-09-12
- 0.3.5 — 2022-09-12
- 0.3.4 — 2022-07-13
- 0.3.3 — 2022-07-10
- 0.3.2 — 2022-07-10
- … 24 more at https://npm.io/package/call-func/versions

## README

# Call Function

- GIT
  - https://github.com/react-atomic/react-atomic-organism/tree/main/packages/lib/call-func
- NPM
  - https://www.npmjs.com/package/call-func

## `Event addEventListener wrapper`

- `subscribe`

**HTML**

```html
<button>Click</button>
```

**JS**

```js
import { register, cleanAllRegister } from "call-func";
const oReg = register(document.querySelector("button"));
const regId = oReg.addEventListener("click", () => {
  console.log("click");
});
```

- `unsubscribe` by id

```js
// clean one
oReg.removeEventListener(regId);

// clean one dom events by type.
oReg.cleanAll("click");

// clean one dom all events.
oReg.cleanAll();

// clean events which regist by this library.
cleanAllRegister();
```

- [More Example](https://github.com/react-atomic/react-atomic-organism/blob/main/packages/lib/call-func/src/__tests__/registerTest.js)

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