From 4dae666bde1a85a7469438dee45fead208e8e775 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Sun, 11 Aug 2024 14:44:16 +0200 Subject: [PATCH] feat: Expose appDict --- lib/mixins/connect.js | 2 +- lib/remote-debugger.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/mixins/connect.js b/lib/mixins/connect.js index 87c0275..6fcfcc8 100644 --- a/lib/mixins/connect.js +++ b/lib/mixins/connect.js @@ -89,7 +89,7 @@ export async function connect (timeout = APP_CONNECT_TIMEOUT_MS) { this.log.debug(`Timed out waiting for applications to be reported`); } } - return _.cloneDeep(getAppDict(this)); + return this.appDict; } catch (err) { this.log.error(`Error setting connection key: ${err.message}`); await this.disconnect(); diff --git a/lib/remote-debugger.ts b/lib/remote-debugger.ts index eb744b2..c581212 100644 --- a/lib/remote-debugger.ts +++ b/lib/remote-debugger.ts @@ -236,6 +236,13 @@ export class RemoteDebugger extends EventEmitter { return !!this._rpcClient?.isConnected; } + // Only use this getter to read the appDict value. + // Any changes to it don't mutate the original property + // because the getter always returns the copy of it + get appDict(): AppDict { + return _.cloneDeep(this._appDict); + } + set allowNavigationWithoutReload (allow: boolean) { this._allowNavigationWithoutReload = allow; }