From 6489d1b8313579325bbad067fa7ebfb5d069881e Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Thu, 18 Apr 2024 16:07:19 +0100 Subject: [PATCH] update renderer and main creation methods --- packages/electron/src/client/createClient.js | 6 +++--- packages/electron/src/client/main.js | 4 ++-- packages/electron/src/client/renderer.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/electron/src/client/createClient.js b/packages/electron/src/client/createClient.js index e2fbfe4e05..a7bc71015f 100644 --- a/packages/electron/src/client/createClient.js +++ b/packages/electron/src/client/createClient.js @@ -1,6 +1,6 @@ const Client = require('@bugsnag/core/client') -const createClient = (createClient, process) => { +const createClient = (createProcessClient, process) => { const Bugsnag = { _client: null, lastRunInfo: null, @@ -14,8 +14,8 @@ const createClient = (createClient, process) => { if (typeof opts === 'string') opts = { apiKey: opts } if (!opts) opts = {} - // create the relevant client for the detected environment - Bugsnag._client = createClient(opts) + // create the relevant client for the provided process + Bugsnag._client = createProcessClient(opts) Object.defineProperty(Bugsnag, 'lastRunInfo', { get: process === 'main' diff --git a/packages/electron/src/client/main.js b/packages/electron/src/client/main.js index 71c1f4e645..4313b5d277 100644 --- a/packages/electron/src/client/main.js +++ b/packages/electron/src/client/main.js @@ -16,7 +16,7 @@ const { schema } = require('../config/main') Event.__type = 'electronnodejs' -const createMain = (opts) => { +const createMainClient = (opts) => { // check api key has been provided as we need it to create the FileStore // which happens before the API key is validated if (typeof opts.apiKey !== 'string') { @@ -84,7 +84,7 @@ const createMain = (opts) => { } // Construct the client -const Bugsnag = createClient(createMain, 'main') +const Bugsnag = createClient(createMainClient, 'main') // commonjs module.exports = Bugsnag diff --git a/packages/electron/src/client/renderer.js b/packages/electron/src/client/renderer.js index ccdf70a0af..876e362596 100644 --- a/packages/electron/src/client/renderer.js +++ b/packages/electron/src/client/renderer.js @@ -9,7 +9,7 @@ const { schema, mergeOptions } = require('../config/renderer') Event.__type = 'electronrendererjs' -const createRenderer = (rendererOpts) => { +const createRendererClient = (rendererOpts) => { if (!window.__bugsnag_ipc__) throw new Error('Bugsnag was not loaded in the main process') const internalPlugins = [ @@ -83,7 +83,7 @@ const createRenderer = (rendererOpts) => { } // Construct the client -const Bugsnag = createClient(createRenderer, 'renderer') +const Bugsnag = createClient(createRendererClient, 'renderer') // commonjs module.exports = Bugsnag