From 29125ab6a395709020bced352bd9883162e53e7a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 8 Sep 2022 07:29:30 -0400 Subject: [PATCH] *Move fetching request to a private helper --- src/webEngine.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/webEngine.ts b/src/webEngine.ts index 1437206..d60057b 100644 --- a/src/webEngine.ts +++ b/src/webEngine.ts @@ -175,9 +175,7 @@ export default class WebEngine { method: string, def = {} ): Promise { - 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; + } }