-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Type Emitter Implementation (#399)
Co-authored-by: Tasso Evangelista <[email protected]>
- Loading branch information
Showing
25 changed files
with
346 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [AnyEventHandlerOf](./emitter.anyeventhandlerof.md) | ||
|
||
## AnyEventHandlerOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type AnyEventHandlerOf<EventMap extends DefaultEventMap> = { | ||
[EventType in keyof EventMap]: EventMap[EventType] extends void ? () => void : (event: EventMap[EventType]) => void; | ||
}[keyof EventMap]; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [AnyEventOf](./emitter.anyeventof.md) | ||
|
||
## AnyEventOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type AnyEventOf<EventMap extends DefaultEventMap> = EventMap[keyof EventMap]; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [AnyEventTypeOf](./emitter.anyeventtypeof.md) | ||
|
||
## AnyEventTypeOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type AnyEventTypeOf<EventMap extends DefaultEventMap> = keyof EventMap; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md) | ||
|
6 changes: 3 additions & 3 deletions
6
packages/emitter/docs/emitter.handler.md → ...s/emitter/docs/emitter.defaulteventmap.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [Handler](./emitter.handler.md) | ||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [DefaultEventMap](./emitter.defaulteventmap.md) | ||
|
||
## Handler type | ||
## DefaultEventMap type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type Handler<T = any> = (event?: T) => void; | ||
export declare type DefaultEventMap = Record<string | symbol, unknown>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [EventHandlerOf](./emitter.eventhandlerof.md) | ||
|
||
## EventHandlerOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type EventHandlerOf<EventMap extends DefaultEventMap, EventType extends AnyEventTypeOf<EventMap>> = EventMap[EventType] extends void ? () => void : (event: EventMap[EventType]) => void; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md)<!-- -->, [AnyEventTypeOf](./emitter.anyeventtypeof.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [EventOf](./emitter.eventof.md) | ||
|
||
## EventOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type EventOf<EventMap extends DefaultEventMap, EventType extends AnyEventTypeOf<EventMap>> = EventMap[EventType] extends void ? never : EventMap[EventType]; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md)<!-- -->, [AnyEventTypeOf](./emitter.anyeventtypeof.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/emitter](./emitter.md) > [EventTypeOf](./emitter.eventtypeof.md) | ||
|
||
## EventTypeOf type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type EventTypeOf<EventMap extends DefaultEventMap, EventValue extends EventMap[keyof EventMap]> = { | ||
[EventType in keyof EventMap]: EventMap[EventType] extends EventValue ? EventType : never; | ||
}[keyof EventMap]; | ||
``` | ||
<b>References:</b> [DefaultEventMap](./emitter.defaulteventmap.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.