# simon-js-tool

> js-tool

Latest version **4.2.1** (published 2022-12-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install simon-js-tool
pnpm add simon-js-tool
yarn add simon-js-tool
bun add simon-js-tool
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.2.1 |
| Published | 2022-12-05 |
| First published | 2022-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 178.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Simon He |
| Maintainers | simon_he |
| Keywords | simon-js-tool, utils |

## Links

- npm: https://www.npmjs.com/package/simon-js-tool
- Repository: https://github.com/Simon-He95/simon-js-tool
- Homepage: https://github.com/Simon-He95/simon-js-tool#readme
- Issues: https://github.com/Simon-He95/simon-js-tool/issues
- npm.io page: https://npm.io/package/simon-js-tool

## Dependencies (5)

- [vue](https://npm.io/package/vue.md) ^3.2.41
- [qrcode](https://npm.io/package/qrcode.md) ^1.5.1
- [spark-md5](https://npm.io/package/spark-md5.md) ^3.0.2
- [htmlparser2](https://npm.io/package/htmlparser2.md) ^8.0.1
- [@vueuse/core](https://npm.io/package/@vueuse/core.md) ^8.9.4

## Recent versions

- 4.2.1 (latest) — 2022-12-05
- 4.2.0 — 2022-12-05
- 4.1.33 — 2022-12-04
- 4.1.32 — 2022-12-02
- 4.1.31 — 2022-12-01
- 4.1.30 — 2022-11-29
- 4.1.29 — 2022-11-24
- 4.1.28 — 2022-11-23
- 4.1.27 — 2022-11-21
- 4.1.26 — 2022-11-11
- 4.1.25 — 2022-11-10
- 4.1.24 — 2022-11-10
- 4.1.23 — 2022-11-10
- 4.1.22 — 2022-11-10
- 4.1.21 — 2022-11-04
- … 147 more at https://npm.io/package/simon-js-tool/versions

## README

<p align="center">
<img height="200" src="./assets/kv.png" alt="simon-js-tool">
</p>
<p align="center"><a href="https://www.npmjs.com/package/simon-js-tool"><img src="https://img.shields.io/npm/v/simon-js-tool?color=3fb883&amp;label=" alt="NPM version"></a>
<a href="https://www.npmjs.com/package/simon-js-tool"><img src="https://img.shields.io/npm/dm/simon-js-tool?style=social" alt="NPM version"></a>
<a href="https://github.com/Simon-He95/simon-js-tool"><img src="https://img.shields.io/github/stars/Simon-He95/simon-js-tool?style=social" alt="NPM version"></a>
</p>
<p align="center"><a href="http://vitepress.hejian.club/">文档</a></p>
<p align="center"> <a href="./README_en.md">English</a> | 简体中文</p>

目前整理了<strong>100+</strong>的常用函数,还在持续更新中...,你的认可是对我最大的鼓励 :hearts:


## :100: 亮点
- 纯js的工具函数,可使用在任何可执行js的环境
- 大量减少`ref<HTMLElment>` 和 `onMounted`的使用，可以script标签直接调用
- 所有的副作用函数都能返回一个stop函数，可以在任意地方停止事件的执行，并且在页面销毁时自动销毁事件
- api设计简单、实用、类型友好

## &#x270B; 例子
```js
import { animationFrameWrapper, insertElement, useEventListener, useMutationObserver } from 'simon-js-tool'
// 监听container的变化, 你不在需要const container = ref<HTMLElement>
useMutationObserver('#container', (mutationsList, observer) => {
  console.log(mutationsList)
})
// requestAnimationFrame
animationFrameWrapper((timestamp) => {
  // 每针相隔1s执行
  console.log('animationFrame', timestamp)
}, 1000, true /* 只执行一次后被销毁 */)
// 注册事件
useEventListener('#container', 'click', () => {
  console.log('click')
})
// 插入元素
insertElement('#container', '.content')
// 删除元素
removeElement('.content')
```
```html
<div id="container"></div>
<div class="content">hello world</div>
```

## :balloon: 更多
- 导出函数 [exports-function](https://github.com/SimonHe1995/exportsFunction)
- threejs [@simon_he/s-three]Charts [@simon_he/s-chart](https://github.com/SimonHe1995/sCharts)
- numsWheel [@simon_he/nums-wheel](https://github.com/SimonHe1995/numsWheel)
- vAxios [@simon_he/v-axios](https://github.com/SimonHe1995/vAxios)



## :book: 使用说明
```bash
npm i simon-js-tool # 安装

import { 
  deepCompare
 } from 'simon-js-tool' # 按需引入

```

## 👉 [文档](http://vitepress.hejian.club/)


## :coffee: 
[请我喝一杯咖啡](https://github.com/Simon-He95/sponsor)

## License
[MIT](./license)

## GitHub地址
[欢迎PR](https://github.com/Simon-He95/simon-js-tool)

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