UNPKG

@yugu/subscribe

Version:

使用`import Subscribe from "@yugu/subscribe"`导入类 通过`const pool = new Subscribe`创建发布订阅实例 该类实例可以通过`add`方式向订阅池中添加事件,`pool.add(fn)` 该类实例可以通过`remove`方式从订阅池中移除事件,`pool.remove(fn)` 该类实例可以通过`fire`方式触发订阅池中所有的函数,`pool.fire()` ```js <script type="module"> imp

40 lines 833 B
{ "name": "@yugu/subscribe", "version": "1.0.1", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", "module": "dist/index.mjs", "exports": { ".": { "require": "./dist/index.js", "import": "./dist/index.mjs", "types": "./dist/index.d.ts" } }, "files": [ "dist" ], "keywords": [ "发布订阅", "subscribe", "pubsub" ], "homepage": "https://github.com/yuguaa/yuguaa-subscribe", "repository": { "type": "git", "url": "https://github.com/yuguaa/yuguaa-subscribe" }, "author": "yuguaa", "license": "ISC", "devDependencies": { "bumpp": "^8.2.1", "tsup": "^6.6.0", "typescript": "^4.9.5" }, "scripts": { "build": "tsup", "dev": "tsup --watch", "release": "pnpm build && pnpm publish --access public" } }