@wxn0brp/falcon-frame 0.6.2 → 0.6.3
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/dist/index.d.ts +4 -4
- package/dist/index.js +2 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { renderHTML } from "./render.js";
|
|
|
4
4
|
import { FFResponse } from "./res.js";
|
|
5
5
|
import { Router } from "./router.js";
|
|
6
6
|
import type { BeforeHandleRequest, CombinedVars, EngineCallback, ErrorHandler, FFOpts, FFRequest, RouteHandler, ValidationErrorFormatter } from "./types.js";
|
|
7
|
-
export declare class FalconFrame<Vars extends Record<string, any> =
|
|
7
|
+
export declare class FalconFrame<Vars extends Record<string, any> = {}> extends Router {
|
|
8
8
|
logger: Logger;
|
|
9
9
|
bodyParsers: RouteHandler[];
|
|
10
10
|
vars: CombinedVars<Vars>;
|
|
@@ -19,9 +19,9 @@ export declare class FalconFrame<Vars extends Record<string, any> = Record<strin
|
|
|
19
19
|
listen(port: number | string, callback?: (() => void) | boolean, beforeHandleRequest?: BeforeHandleRequest): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
20
20
|
getApp(beforeHandleRequest?: BeforeHandleRequest): (req: any, res: any) => Promise<void>;
|
|
21
21
|
engine(ext: string, callback: EngineCallback): this;
|
|
22
|
-
setVar
|
|
23
|
-
set
|
|
24
|
-
getVar
|
|
22
|
+
setVar<K extends keyof CombinedVars<Vars>>(key: K, value: CombinedVars<Vars>[K]): this;
|
|
23
|
+
set<K extends keyof CombinedVars<Vars>>(key: K, value: CombinedVars<Vars>[K]): this;
|
|
24
|
+
getVar<K extends keyof CombinedVars<Vars>>(key: K): CombinedVars<Vars>[K];
|
|
25
25
|
/**
|
|
26
26
|
* Sets the allowed origins for CORS.
|
|
27
27
|
* This method is a shortcut that simplifies CORS configuration
|
package/dist/index.js
CHANGED
|
@@ -102,15 +102,13 @@ export class FalconFrame extends Router {
|
|
|
102
102
|
return this;
|
|
103
103
|
}
|
|
104
104
|
setVar(key, value) {
|
|
105
|
-
// @ts-ignore
|
|
106
105
|
this.vars[key] = value;
|
|
106
|
+
return this;
|
|
107
107
|
}
|
|
108
108
|
set(key, value) {
|
|
109
|
-
|
|
110
|
-
this.vars[key] = value;
|
|
109
|
+
return this.setVar(key, value);
|
|
111
110
|
}
|
|
112
111
|
getVar(key) {
|
|
113
|
-
// @ts-ignore
|
|
114
112
|
return this.vars[key];
|
|
115
113
|
}
|
|
116
114
|
/**
|