Skip to content

Commit

Permalink
Hotfix card module has no access to window
Browse files Browse the repository at this point in the history
  • Loading branch information
lucajoos committed Apr 29, 2021
1 parent 88716b9 commit f50f5fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/cards.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const fs = require('fs');
const path = require('path');
const gifFrames = require('gif-frames');
const { ipcMain, clipboard } = require('electron');
const { ipcMain, clipboard, BrowserWindow } = require('electron');
const { RESOURCES_PATH, PREVIEWS_PATH } = require('./constants')
const Store = require('electron-store');

const store = new Store();

module.exports = window => {
module.exports = () => {
ipcMain.on('drop', (event, paths) => {
let cf = index => {
const cc = store.get('length') + 1;
Expand Down Expand Up @@ -67,6 +67,7 @@ module.exports = window => {

ipcMain.on('copy', (event, file) => {
if(file) {
const window = BrowserWindow.getFocusedWindow();
const bn = path.basename(file).split('.');
const ex = bn[bn.length - 1];

Expand All @@ -83,7 +84,7 @@ module.exports = window => {
});
}

if(!!window) {
if(window) {
window.close();
}
}
Expand Down

0 comments on commit f50f5fc

Please sign in to comment.