Skip to content

Commit

Permalink
update renderer and main creation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerbenw committed Apr 18, 2024
1 parent 73e0b84 commit 6489d1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/electron/src/client/createClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Client = require('@bugsnag/core/client')

const createClient = (createClient, process) => {
const createClient = (createProcessClient, process) => {
const Bugsnag = {
_client: null,
lastRunInfo: null,
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/src/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -84,7 +84,7 @@ const createMain = (opts) => {
}

// Construct the client
const Bugsnag = createClient(createMain, 'main')
const Bugsnag = createClient(createMainClient, 'main')

// commonjs
module.exports = Bugsnag
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/src/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -83,7 +83,7 @@ const createRenderer = (rendererOpts) => {
}

// Construct the client
const Bugsnag = createClient(createRenderer, 'renderer')
const Bugsnag = createClient(createRendererClient, 'renderer')

// commonjs
module.exports = Bugsnag
Expand Down

0 comments on commit 6489d1b

Please sign in to comment.