Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 59 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | // jshint esversion: 8 |
||
3 | const electron = require('electron'), |
||
4 | debug = require('debug')('main.bw.fileinput'); |
||
5 | |||
6 | const { |
||
7 | app, |
||
8 | BrowserWindow, |
||
9 | Menu, |
||
10 | ipcMain, |
||
11 | dialog |
||
12 | } = electron; |
||
13 | |||
14 | var settings = require('../../common/settings').load(); |
||
15 | |||
16 | /* |
||
17 | ipcMain.on('bw:input.file', function(...) {...}); |
||
18 | On event: Bulk whois input file, select file dialog |
||
19 | parameters |
||
20 | event (object) - renderer object |
||
21 | */ |
||
22 | ipcMain.on('bw:input.file', function(event) { |
||
23 | debug("Waiting for file selection"); |
||
24 | var filePath = dialog.showOpenDialogSync({ |
||
25 | title: "Select wordlist file", |
||
26 | buttonLabel: "Open", |
||
27 | properties: ['openFile', 'showHiddenFiles'] |
||
28 | }); |
||
29 | |||
30 | var { |
||
31 | sender |
||
32 | } = event; |
||
33 | |||
34 | debug("Using selected file at {0}".format(filePath)); |
||
35 | sender.send('bw:fileinput.confirmation', filePath); |
||
36 | }); |
||
37 | |||
38 | /* |
||
39 | ipcMain.on('ondragstart', function(...) {...}); |
||
40 | On event: drag and dropping file |
||
41 | parameters |
||
42 | event (object) - renderer object |
||
43 | filePath (string) - dropped file path |
||
44 | */ |
||
45 | ipcMain.on('ondragstart', function(event, filePath) { |
||
46 | const { |
||
47 | 'app.window': appWindow |
||
48 | } = settings; |
||
49 | |||
50 | var { |
||
51 | sender |
||
52 | } = event; |
||
53 | |||
54 | sender.startDrag({ |
||
55 | file: filePath, |
||
56 | icon: appWindow.icon |
||
|
|||
57 | }); |
||
58 | |||
59 | debug('File drag filepath: {0}'.format(filePath)); |
||
60 | sender.send('bw:fileinput.confirmation', filePath, true); |
||
61 | }); |
||
62 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.