Skip to content

Commit

Permalink
Use global ipcMain
Browse files Browse the repository at this point in the history
  • Loading branch information
romeovs committed Nov 6, 2024
1 parent bd1f0da commit 055b38c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
shell,
} from "electron"
import serve from "electron-serve"

import * as history from "./history"
import { NTSLiveTracks } from "./live-tracks"
import * as preferences from "./preferences"
Expand All @@ -39,7 +40,7 @@ export class NTSApplication {
this.tray = makeTray()
this.evts = new EventEmitter()
this.production = production
this.liveTracks = new NTSLiveTracks(ipcMain, this.window.webContents)
this.liveTracks = new NTSLiveTracks(this.window.webContents)
}

async init() {
Expand Down
9 changes: 3 additions & 6 deletions app/live-tracks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { IpcMain, IpcMainInvokeEvent, WebContents } from "electron"
import { type IpcMainInvokeEvent, type WebContents, ipcMain } from "electron"
import { type FirebaseOptions, initializeApp } from "firebase/app"
import {
type UserCredential,
getAuth,
reauthenticateWithCredential,
signInWithEmailAndPassword,
} from "firebase/auth"
import {
Expand Down Expand Up @@ -69,7 +68,6 @@ function liveTracks(stream: 1 | 2, fn: Handler): () => void {
}

export class NTSLiveTracks {
ipcMain: IpcMain
webContents: WebContents

promises: { [creds: string]: Promise<UserCredential> } = {}
Expand All @@ -81,16 +79,15 @@ export class NTSLiveTracks {

creds: any | null

constructor(ipcMain: IpcMain, webContents: WebContents) {
this.ipcMain = ipcMain
constructor(webContents: WebContents) {
this.webContents = webContents
this.unsubscribe = null
this.previous = {
stream1: [],
stream2: [],
}

this.ipcMain.handle("login-credentials", this._handleLogin.bind(this))
ipcMain.handle("login-credentials", this._handleLogin.bind(this))
}

async init() {
Expand Down

0 comments on commit 055b38c

Please sign in to comment.