# @ctsy/hook

Latest version **0.0.7** (published 2020-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ctsy/hook
pnpm add @ctsy/hook
yarn add @ctsy/hook
bun add @ctsy/hook
```

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2020-08-02 |
| First published | 2019-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 127.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | CastleMY |
| Maintainers | ida_xyt, yanpengquan |
| Keywords | ctsy, tansuyun, yanpengquan, ctsy, auth, api, auth-api, 登陆, 注册 |

## Links

- npm: https://www.npmjs.com/package/@ctsy/hook
- Repository: https://github.com/YanCastle/castle-hook
- npm.io page: https://npm.io/package/@ctsy/hook

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2020-08-02
- 0.0.6 — 2020-01-24
- 0.0.5 — 2019-08-09
- 0.0.4 — 2019-07-18
- 0.0.3 — 2019-07-09
- 0.0.2 — 2019-06-11
- 0.0.1 — 2019-06-03

## README

Hook Library
设计思路：
在框架执行过程中需要针对某些执行场景进行统计、权限判断等，为了实现Aop风格的调用和动态的调整，因此编写此库。
核心用法
```typescript
//注册hook事件
import hook from './hook'
import { HookWhen } from './hook';
//注册一个后置事件
hook.regist('Login',HookWhen.After,'LoginAuthCheck',()=>{},true)
//触发事件
hook.emit('Login', HookWhen.After, {}, {})
// 每次触发需要传入2个参数，
// 内部的同步函数会先自行，然后再是异步，
```

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