3.3.3 • Published 5 years ago

sati-dispatch v3.3.3

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

sati-dispatch

Small, simple and common dispatch create by laidx;

一个小巧,通用的dispatch库,是一个自定义事件调度器,支持on,call,apply,支持命名空间管理。

支持申明式:先调用register注册所有事件,再调用on,call等方式使用。
非严格模式:无需register,引入后调用on的同时注册事件。
通过new Dispatch(options)时,设置options的strict属性(boolean)。

前言

laidx(boom),前端小白菜一枚,纪念下在我入行8个月左右,发布了我的第一个npm包吧 (ゝ∀・)b

目的是解决: 想要使用d3-dispatch,或者vue的eventbus等等类似的事件调度器时,又不需要完整的引入像d3,vue等如此巨大的库。

因此,就自己实现了一个没有任何依赖的小巧的dispatch,一如常用的使用方法通过npm或者浏览器脚本引入。

Installing

If you use npm.For example:

npm install sati-dispatch;

Get start

import * as Dispatch from 'sati-dispatch';

Import Dispatch

const dispatch = new Dispatch();

API

  • register - Register events in strict mode

  • on - Listent the event and set a callback function.The function will be trigger When event is dispatched

  • call - Afferent a eventName(can be namespace) and trigger this event when it has been matched

  • apply - just like call.The only different is the parameter in callback function was array.

  • remove - Remove event by name and it will remove the all callback functions in thie namespace.

3.3.3

5 years ago

3.3.2

5 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago