routup 3.0.0-alpha.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -19
- package/dist/adapters/node/module.d.ts +7 -0
- package/dist/{utils → adapters/raw}/header.d.ts +1 -1
- package/dist/{layer → adapters/raw}/index.d.ts +1 -1
- package/dist/adapters/raw/module.d.ts +4 -0
- package/dist/{dispatcher/adapters → adapters}/raw/type.d.ts +1 -1
- package/dist/adapters/web/module.d.ts +4 -0
- package/dist/constants.d.ts +7 -7
- package/dist/dispatcher/event/dispatch.d.ts +4 -0
- package/dist/dispatcher/event/error.d.ts +5 -0
- package/dist/dispatcher/event/index.d.ts +5 -0
- package/dist/dispatcher/event/is.d.ts +3 -0
- package/dist/dispatcher/event/module.d.ts +56 -0
- package/dist/dispatcher/event/types.d.ts +9 -0
- package/dist/dispatcher/index.d.ts +1 -2
- package/dist/dispatcher/type.d.ts +2 -30
- package/dist/error/create.d.ts +3 -3
- package/dist/error/is.d.ts +2 -2
- package/dist/error/module.d.ts +1 -1
- package/dist/handler/constants.d.ts +1 -0
- package/dist/handler/core/define.d.ts +4 -3
- package/dist/handler/core/types.d.ts +3 -3
- package/dist/handler/error/define.d.ts +4 -3
- package/dist/handler/error/types.d.ts +5 -5
- package/dist/handler/index.d.ts +1 -0
- package/dist/handler/is.d.ts +3 -1
- package/dist/handler/module.d.ts +23 -0
- package/dist/handler/types-base.d.ts +6 -2
- package/dist/handler/types.d.ts +3 -4
- package/dist/hook/constants.d.ts +8 -0
- package/dist/hook/index.d.ts +3 -0
- package/dist/hook/module.d.ts +19 -0
- package/dist/hook/types.d.ts +5 -0
- package/dist/index.cjs +658 -468
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +649 -461
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/types.d.ts +0 -5
- package/dist/response/helpers/send-web-blob.d.ts +1 -1
- package/dist/response/helpers/send-web-response.d.ts +1 -1
- package/dist/router/constants.d.ts +8 -0
- package/dist/router/index.d.ts +0 -1
- package/dist/router/module.d.ts +58 -24
- package/dist/router/types.d.ts +7 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/method.d.ts +3 -0
- package/dist/utils/next.d.ts +2 -0
- package/package.json +8 -8
- package/dist/dispatcher/adapters/node/module.d.ts +0 -7
- package/dist/dispatcher/adapters/raw/module.d.ts +0 -4
- package/dist/dispatcher/adapters/web/index.d.ts +0 -2
- package/dist/dispatcher/adapters/web/module.d.ts +0 -5
- package/dist/dispatcher/utils.d.ts +0 -5
- package/dist/layer/constants.d.ts +0 -1
- package/dist/layer/module.d.ts +0 -17
- package/dist/layer/type.d.ts +0 -8
- package/dist/layer/utils.d.ts +0 -2
- /package/dist/{dispatcher/adapters → adapters}/index.d.ts +0 -0
- /package/dist/{dispatcher/adapters → adapters}/node/index.d.ts +0 -0
- /package/dist/{dispatcher/adapters/raw → adapters/web}/index.d.ts +0 -0
- /package/dist/{dispatcher/adapters → adapters}/web/type.d.ts +0 -0
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ npm install routup --save
|
|
|
40
40
|
- 🚀 runtime agnostic (Node.JS, Bun, Deno, ...)
|
|
41
41
|
- 📝 different handler types (base & error)
|
|
42
42
|
- ✨ promise (async) support for core- & error-handlers
|
|
43
|
+
- 📌 robust hook system
|
|
43
44
|
- 🔌 powerful plugin system
|
|
44
45
|
- 🧰 tree shakeable response & request helpers
|
|
45
46
|
- 🤝️ different handler declaration styles (shorthand & verbose)
|
|
@@ -61,6 +62,8 @@ as all concepts and basics are taught there.
|
|
|
61
62
|
### Handlers
|
|
62
63
|
|
|
63
64
|
Both core and error handlers, can be defined in two different ways.
|
|
65
|
+
Core handler functions can have up to 3 arguments (req, res, next) whereas error handler functions can have up to 4 arguments (err, req, res, next).
|
|
66
|
+
This should be familiar to anyone who has used express before.
|
|
64
67
|
|
|
65
68
|
**`Shorthand`**
|
|
66
69
|
|
|
@@ -187,17 +190,18 @@ According to the fact that routup is a minimalistic framework,
|
|
|
187
190
|
it depends on [plugins](https://github.com/routup/plugins) to cover some
|
|
188
191
|
typically http framework functions, which are not integrated in the main package.
|
|
189
192
|
|
|
190
|
-
| Name
|
|
191
|
-
|
|
192
|
-
| [
|
|
193
|
-
| [
|
|
194
|
-
| [
|
|
195
|
-
| [
|
|
196
|
-
| [
|
|
197
|
-
| [
|
|
198
|
-
| [
|
|
199
|
-
| [
|
|
200
|
-
| [
|
|
193
|
+
| Name | Description |
|
|
194
|
+
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
|
|
195
|
+
| [assets](https://github.com/routup/plugins/tree/master/packages/assets) | Serve static files from a directory. |
|
|
196
|
+
| [basic](https://github.com/routup/plugins/tree/master/packages/basic) | Bundle of the body, cookie and query plugin. |
|
|
197
|
+
| [body](https://github.com/routup/plugins/tree/master/packages/body) | Read and parse the request body. |
|
|
198
|
+
| [cookie](https://github.com/routup/plugins/tree/master/packages/cookie) | Read and parse request cookies and serialize cookies for the response. |
|
|
199
|
+
| [decorators](https://github.com/routup/plugins/tree/master/packages/decorators) | Create request handlers with class-, method- & parameter-decorators. |
|
|
200
|
+
| [prometheus](https://github.com/routup/plugins/tree/master/packages/prometheus) | Collect and serve metrics for prometheus. |
|
|
201
|
+
| [query](https://github.com/routup/plugins/tree/master/packages/query) | Read and parse the query string of the request url. |
|
|
202
|
+
| [rate-limit](https://github.com/routup/plugins/tree/master/packages/rate-limit) | Rate limit incoming requests. |
|
|
203
|
+
| [rate-limit-redis](https://github.com/routup/plugins/tree/master/packages/rate-limit-redis) | Redis adapter for the rate-limit plugin. |
|
|
204
|
+
| [swagger](https://github.com/routup/plugins/tree/master/packages/swagger) | Serve generated docs from URL or based on a JSON file. |
|
|
201
205
|
|
|
202
206
|
## Benchmarks
|
|
203
207
|
|
|
@@ -207,14 +211,14 @@ typically http framework functions, which are not integrated in the main package
|
|
|
207
211
|
* Date: `Wed Sep 13 2023 15:11:58 GMT+0200 (Mitteleuropäische Sommerzeit) `
|
|
208
212
|
* Method: `autocannon -c 100 -d 40 -p 10 localhost:3000` (two rounds; one to warm-up, one to measure)
|
|
209
213
|
|
|
210
|
-
| Package | Requests/s |
|
|
211
|
-
|
|
212
|
-
| http | 61062 |
|
|
213
|
-
| fastify | 59679 |
|
|
214
|
-
| koa | 45763 |
|
|
215
|
-
| **routup** |
|
|
216
|
-
| hapi | 41374 |
|
|
217
|
-
| express | 13376 |
|
|
214
|
+
| Package | Requests/s | Latency (ms) | Throughput/MB |
|
|
215
|
+
|:-----------|:-----------:|-------------:|--------------:|
|
|
216
|
+
| http | 61062 | 15.87 | 10.89 |
|
|
217
|
+
| fastify | 59679 | 16.26 | 10.70 |
|
|
218
|
+
| koa | 45763 | 21.35 | 8.16 |
|
|
219
|
+
| **routup** | 44588 | 21.91 | 9.02 |
|
|
220
|
+
| hapi | 41374 | 23.67 | 7.38 |
|
|
221
|
+
| express | 13376 | 74.18 | 2.39 |
|
|
218
222
|
|
|
219
223
|
Benchmarks were generated using autocannon.
|
|
220
224
|
To recreate the results, this can be done using the [benchmarks'](https://github.com/routup/benchmarks) repository.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { RequestListener } from 'node:http';
|
|
3
|
+
import type { Request } from '../../request';
|
|
4
|
+
import type { Response } from '../../response';
|
|
5
|
+
import type { Router } from '../../router';
|
|
6
|
+
export declare function dispatchNodeRequest(router: Router, request: Request, response: Response): Promise<void>;
|
|
7
|
+
export declare function createNodeDispatcher(router: Router): RequestListener;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RawResponseHeader } from '
|
|
1
|
+
import type { RawResponseHeader } from './type';
|
|
2
2
|
export declare function transformHeaderToTuples(key: string, value: RawResponseHeader): [string, string][];
|
|
3
3
|
export declare function transformHeadersToTuples(input: Record<string, RawResponseHeader>): [string, string][];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Router } from '../../router';
|
|
2
|
+
import type { RawRequest, RawResponse } from './type';
|
|
3
|
+
export declare function dispatchRawRequest(router: Router, request: RawRequest): Promise<RawResponse>;
|
|
4
|
+
export declare function createRawDispatcher(router: Router): (request: RawRequest) => Promise<RawResponse>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Router } from '../../router';
|
|
2
|
+
import type { WebRequest } from '../../types';
|
|
3
|
+
export declare function dispatchWebRequest(router: Router, request: WebRequest): Promise<Response>;
|
|
4
|
+
export declare function createWebDispatcher(router: Router): (request: WebRequest) => Promise<Response>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare enum MethodName {
|
|
2
|
-
GET = "
|
|
3
|
-
POST = "
|
|
4
|
-
PUT = "
|
|
5
|
-
PATCH = "
|
|
6
|
-
DELETE = "
|
|
7
|
-
OPTIONS = "
|
|
8
|
-
HEAD = "
|
|
2
|
+
GET = "GET",
|
|
3
|
+
POST = "POST",
|
|
4
|
+
PUT = "PUT",
|
|
5
|
+
PATCH = "PATCH",
|
|
6
|
+
DELETE = "DELETE",
|
|
7
|
+
OPTIONS = "OPTIONS",
|
|
8
|
+
HEAD = "HEAD"
|
|
9
9
|
}
|
|
10
10
|
export declare enum HeaderName {
|
|
11
11
|
ACCEPT = "accept",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MethodName } from '../../constants';
|
|
2
|
+
import type { RoutupError } from '../../error';
|
|
3
|
+
import type { Request } from '../../request';
|
|
4
|
+
import type { Response } from '../../response';
|
|
5
|
+
import type { Next } from '../../types';
|
|
6
|
+
import type { DispatchEventCreateContext } from './types';
|
|
7
|
+
export declare class DispatchEvent {
|
|
8
|
+
/**
|
|
9
|
+
* Request Object.
|
|
10
|
+
*/
|
|
11
|
+
request: Request;
|
|
12
|
+
/**
|
|
13
|
+
* Response Object.
|
|
14
|
+
*/
|
|
15
|
+
response: Response;
|
|
16
|
+
/**
|
|
17
|
+
* Params collected during execution.
|
|
18
|
+
*/
|
|
19
|
+
params: Record<string, any>;
|
|
20
|
+
/**
|
|
21
|
+
* Request path.
|
|
22
|
+
*/
|
|
23
|
+
path: string;
|
|
24
|
+
/**
|
|
25
|
+
* HTTP Method used for the request.
|
|
26
|
+
*/
|
|
27
|
+
method: `${MethodName}`;
|
|
28
|
+
/**
|
|
29
|
+
* The relative path on which the router is hung.
|
|
30
|
+
*/
|
|
31
|
+
mountPath: string;
|
|
32
|
+
/**
|
|
33
|
+
* The error which occurred during the dispatch process.
|
|
34
|
+
*/
|
|
35
|
+
error?: RoutupError;
|
|
36
|
+
/**
|
|
37
|
+
* Signal that the request hasn't been handled.
|
|
38
|
+
* Therefore, the request must be passed to the next handler or router in the chain.
|
|
39
|
+
*/
|
|
40
|
+
next: Next;
|
|
41
|
+
/**
|
|
42
|
+
* Indicate if the request has already been dispatched/send.
|
|
43
|
+
*/
|
|
44
|
+
protected _dispatched: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Ids of chained router instances.
|
|
47
|
+
*/
|
|
48
|
+
routerPath: number[];
|
|
49
|
+
/**
|
|
50
|
+
* Collected methods during dispatch process.
|
|
51
|
+
*/
|
|
52
|
+
methodsAllowed: string[];
|
|
53
|
+
constructor(context: DispatchEventCreateContext);
|
|
54
|
+
get dispatched(): boolean;
|
|
55
|
+
set dispatched(value: boolean);
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MethodName } from '../../constants';
|
|
2
|
+
import type { Request } from '../../request';
|
|
3
|
+
import type { Response } from '../../response';
|
|
4
|
+
export type DispatchEventCreateContext = {
|
|
5
|
+
request: Request;
|
|
6
|
+
response: Response;
|
|
7
|
+
method?: `${MethodName}`;
|
|
8
|
+
path?: string;
|
|
9
|
+
};
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Request } from '../request';
|
|
3
|
-
import type { Response } from '../response';
|
|
1
|
+
import type { DispatchEvent } from './event';
|
|
4
2
|
export interface Dispatcher {
|
|
5
|
-
dispatch(event:
|
|
3
|
+
dispatch(event: DispatchEvent): Promise<void>;
|
|
6
4
|
}
|
|
7
|
-
export type DispatcherMeta = {
|
|
8
|
-
/**
|
|
9
|
-
* Params collected on path.
|
|
10
|
-
*/
|
|
11
|
-
params: Record<string, any>;
|
|
12
|
-
/**
|
|
13
|
-
* Path to check for the current instance.
|
|
14
|
-
*/
|
|
15
|
-
path: string;
|
|
16
|
-
/**
|
|
17
|
-
* The relative path on which the router is hung.
|
|
18
|
-
*/
|
|
19
|
-
mountPath: string;
|
|
20
|
-
/**
|
|
21
|
-
* The error which occurred during a previous handler.
|
|
22
|
-
*/
|
|
23
|
-
error?: ErrorProxy;
|
|
24
|
-
/**
|
|
25
|
-
* Ids of chained router instances.
|
|
26
|
-
*/
|
|
27
|
-
routerPath: number[];
|
|
28
|
-
};
|
|
29
|
-
export type DispatcherEvent = {
|
|
30
|
-
req: Request;
|
|
31
|
-
res: Response;
|
|
32
|
-
};
|
package/dist/error/create.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Input } from '@ebec/http';
|
|
2
|
-
import {
|
|
2
|
+
import { RoutupError } from './module';
|
|
3
3
|
/**
|
|
4
|
-
* Create an error
|
|
4
|
+
* Create an internal error object by
|
|
5
5
|
* - an existing error (accessible via cause property)
|
|
6
6
|
* - options
|
|
7
7
|
* - message
|
|
8
8
|
*
|
|
9
9
|
* @param input
|
|
10
10
|
*/
|
|
11
|
-
export declare function createError(input: Input):
|
|
11
|
+
export declare function createError(input: Input | unknown): RoutupError;
|
package/dist/error/is.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function isError(input: unknown): input is
|
|
1
|
+
import { RoutupError } from './module';
|
|
2
|
+
export declare function isError(input: unknown): input is RoutupError;
|
package/dist/error/module.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare function coreHandler(input:
|
|
1
|
+
import { Handler } from '../module';
|
|
2
|
+
import type { CoreHandlerConfig, CoreHandlerFn } from './types';
|
|
3
|
+
export declare function coreHandler(input: Omit<CoreHandlerConfig, 'type'>): Handler;
|
|
4
|
+
export declare function coreHandler(input: CoreHandlerFn): Handler;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Request } from '../../request';
|
|
2
2
|
import type { Response } from '../../response';
|
|
3
|
+
import type { Next } from '../../types';
|
|
3
4
|
import type { HandlerType } from '../constants';
|
|
4
|
-
import type {
|
|
5
|
-
import type { HandlerBase } from '../types-base';
|
|
5
|
+
import type { HandlerBaseConfig } from '../types-base';
|
|
6
6
|
export type CoreHandlerFn = (req: Request, res: Response, next: Next) => unknown | Promise<unknown>;
|
|
7
|
-
export type
|
|
7
|
+
export type CoreHandlerConfig = HandlerBaseConfig & {
|
|
8
8
|
type: `${HandlerType.CORE}`;
|
|
9
9
|
fn: CoreHandlerFn;
|
|
10
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare function errorHandler(input:
|
|
1
|
+
import { Handler } from '../module';
|
|
2
|
+
import type { ErrorHandlerConfig, ErrorHandlerFn } from './types';
|
|
3
|
+
export declare function errorHandler(input: Omit<ErrorHandlerConfig, 'type'>): Handler;
|
|
4
|
+
export declare function errorHandler(input: ErrorHandlerFn): Handler;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RoutupError } from '../../error';
|
|
2
2
|
import type { Request } from '../../request';
|
|
3
3
|
import type { Response } from '../../response';
|
|
4
|
+
import type { Next } from '../../types';
|
|
4
5
|
import type { HandlerType } from '../constants';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
export type ErrorHandler = HandlerBase & {
|
|
6
|
+
import type { HandlerBaseConfig } from '../types-base';
|
|
7
|
+
export type ErrorHandlerFn = (err: RoutupError, req: Request, res: Response, next: Next) => unknown | Promise<unknown>;
|
|
8
|
+
export type ErrorHandlerConfig = HandlerBaseConfig & {
|
|
9
9
|
type: `${HandlerType.ERROR}`;
|
|
10
10
|
fn: ErrorHandlerFn;
|
|
11
11
|
};
|
package/dist/handler/index.d.ts
CHANGED
package/dist/handler/is.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { Handler } from './
|
|
1
|
+
import type { Handler } from './module';
|
|
2
|
+
import type { HandlerConfig } from './types';
|
|
3
|
+
export declare function isHandlerConfig(input: unknown): input is HandlerConfig;
|
|
2
4
|
export declare function isHandler(input: unknown): input is Handler;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MethodName } from '../constants';
|
|
2
|
+
import type { DispatchEvent, Dispatcher } from '../dispatcher';
|
|
3
|
+
import { HookManager } from '../hook';
|
|
4
|
+
import type { Path } from '../path';
|
|
5
|
+
import { PathMatcher } from '../path';
|
|
6
|
+
import type { HandlerConfig } from './types';
|
|
7
|
+
export declare class Handler implements Dispatcher {
|
|
8
|
+
readonly '@instanceof': symbol;
|
|
9
|
+
protected config: HandlerConfig;
|
|
10
|
+
protected hookManager: HookManager;
|
|
11
|
+
protected pathMatcher: PathMatcher | undefined;
|
|
12
|
+
protected _method: MethodName | undefined;
|
|
13
|
+
constructor(handler: HandlerConfig);
|
|
14
|
+
get type(): "error" | "core";
|
|
15
|
+
get path(): Path | undefined;
|
|
16
|
+
get method(): MethodName | undefined;
|
|
17
|
+
dispatch(event: DispatchEvent): Promise<void>;
|
|
18
|
+
matchPath(path: string): boolean;
|
|
19
|
+
setPath(path?: Path): void;
|
|
20
|
+
matchMethod(method: `${MethodName}`): boolean;
|
|
21
|
+
setMethod(input?: `${MethodName}`): void;
|
|
22
|
+
protected mountHooks(): void;
|
|
23
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { MethodName } from '../constants';
|
|
2
|
+
import type { HookDefaultListener, HookErrorListener } from '../hook';
|
|
2
3
|
import type { Path } from '../path';
|
|
3
|
-
export type
|
|
4
|
-
method?:
|
|
4
|
+
export type HandlerBaseConfig = {
|
|
5
|
+
method?: Uppercase<MethodName> | Lowercase<MethodName>;
|
|
5
6
|
path?: Path;
|
|
7
|
+
onError?: HookErrorListener;
|
|
8
|
+
onBefore?: HookDefaultListener;
|
|
9
|
+
onAfter?: HookDefaultListener;
|
|
6
10
|
};
|
package/dist/handler/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export type
|
|
4
|
-
export type Handler = CoreHandler | ErrorHandler;
|
|
1
|
+
import type { CoreHandlerConfig, CoreHandlerFn } from './core';
|
|
2
|
+
import type { ErrorHandlerConfig, ErrorHandlerFn } from './error';
|
|
3
|
+
export type HandlerConfig = CoreHandlerConfig | ErrorHandlerConfig;
|
|
5
4
|
export type HandlerFn = CoreHandlerFn | ErrorHandlerFn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DispatchEvent } from '../dispatcher';
|
|
2
|
+
import { HookName } from './constants';
|
|
3
|
+
import type { HookListener, HookUnsubscribeFn } from './types';
|
|
4
|
+
export declare class HookManager {
|
|
5
|
+
protected items: Record<string, HookListener[]>;
|
|
6
|
+
constructor();
|
|
7
|
+
addListener(name: `${HookName}`, fn: HookListener): HookUnsubscribeFn;
|
|
8
|
+
removeListener(name: `${HookName}`): void;
|
|
9
|
+
removeListener(name: `${HookName}`, fn: HookListener): void;
|
|
10
|
+
/**
|
|
11
|
+
* @throws RoutupError
|
|
12
|
+
*
|
|
13
|
+
* @param name
|
|
14
|
+
* @param event
|
|
15
|
+
*/
|
|
16
|
+
trigger(name: `${HookName}`, event: DispatchEvent): Promise<void>;
|
|
17
|
+
private triggerListener;
|
|
18
|
+
private isErrorListenerHook;
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DispatchErrorEvent, DispatchEvent } from '../dispatcher';
|
|
2
|
+
export type HookErrorListener = (event: DispatchErrorEvent) => Promise<unknown> | unknown;
|
|
3
|
+
export type HookDefaultListener = (event: DispatchEvent) => Promise<unknown> | unknown;
|
|
4
|
+
export type HookListener = HookErrorListener | HookDefaultListener;
|
|
5
|
+
export type HookUnsubscribeFn = () => void;
|