Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
masx200 authored Feb 6, 2020
1 parent 5f3009f commit a0ffc32
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# event-emitter-target
用函数式编程写成的发布订阅事件机制模块

# API

```ts
type EventEmitterTarget = ReturnType<typeof createeventtarget>;
declare function createorclass(this: EventEmitterTarget | undefined): EventEmitterTarget;
type EVENTNAME = string | symbol;
type EVENTLISTENER = (event?: any) => void;
declare function createeventtarget(): {
[Symbol.toStringTag]: string;
listenerCount: (name: EVENTNAME) => number;
clear: (name: EVENTNAME) => void;
removeAllListeners: (name: EVENTNAME) => void;
on: (name: EVENTNAME, callback: EVENTLISTENER) => void;
addListener: (name: EVENTNAME, callback: EVENTLISTENER) => void;
off: (name: EVENTNAME, callback: EVENTLISTENER) => void;
removeListener: (name: EVENTNAME, callback: EVENTLISTENER) => void;
once: (name: EVENTNAME, callback: EVENTLISTENER) => void;
emit: (name: EVENTNAME, event?: any) => void;
dispatch: (name: EVENTNAME, event?: any) => void;
eventNames: () => EVENTNAME[];
listeners: (name: EVENTNAME) => EVENTLISTENER[];
};
declare const a: typeof createorclass;
export { a as default };

```

0 comments on commit a0ffc32

Please sign in to comment.