-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8652 from ever-co/fix/desktop-window-helper
[Fix] Electron Store & Logger
- Loading branch information
Showing
5 changed files
with
92 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ElectronLog from 'electron-log'; | ||
import ElectronStore from 'electron-store'; | ||
import { StoreSchema } from './interfaces/types'; | ||
|
||
// Set up the logger | ||
console.log = ElectronLog.log; | ||
Object.assign(console, ElectronLog.functions); | ||
|
||
// Create a typed store instance | ||
const Store = new ElectronStore<StoreSchema>(); | ||
|
||
// Export the logger and store | ||
export { ElectronLog, Store }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Represents the structure of a file path object used in the application. | ||
*/ | ||
export interface FilePath { | ||
/** | ||
* The path to the icon file associated with this file path. | ||
*/ | ||
iconPath: string; | ||
} | ||
|
||
/** | ||
* Defines the structure of the Electron Store schema for type safety and consistency. | ||
* | ||
* The `StoreSchema` interface represents the schema used in the Electron Store. | ||
* Each property in the schema corresponds to a specific key in the store and | ||
* ensures type safety when accessing or modifying the data. | ||
* | ||
* Example: | ||
* ``` | ||
* const store = new Store<StoreSchema>(); | ||
* store.set('filePath', { iconPath: '/path/to/icon.png' }); | ||
* const filePath = store.get('filePath'); | ||
* console.log(filePath.iconPath); // Outputs: '/path/to/icon.png' | ||
* ``` | ||
*/ | ||
export interface StoreSchema { | ||
/** | ||
* Represents the file path configuration stored in the Electron Store. | ||
* Includes the `iconPath` property which specifies the path to an icon. | ||
*/ | ||
filePath: FilePath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters