*Move fetching request to a private helper

This commit is contained in:
Derrick Hammer 2022-09-08 07:29:30 -04:00
parent 33c6302205
commit 29125ab6a3
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 3 deletions

View File

@ -175,9 +175,7 @@ export default class WebEngine {
method: string,
def = {}
): Promise<BlockingResponse> {
const provider = this.requests.get(details.requestId) as unknown as {
[index: string]: Function;
};
const provider = this.getRequestProvider(details.requestId);
if (!provider) {
return def;
@ -292,4 +290,13 @@ export default class WebEngine {
public getDomainContentProvider(domain: string): BaseProvider | null {
return this.domainContentProvider.get(domain) ?? null;
}
private getRequestProvider(
requestId: string
): { [p: string]: Function } | null {
const provider = this.requests.get(requestId) as unknown as {
[index: string]: Function;
};
return provider ?? null;
}
}