Passed
Push — master ( 65f9b0...e165e5 )
by Eduardo
04:01
created

renderer.js ➔ startup   B

Complexity

Conditions 6

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 17
rs 8.6666
c 0
b 0
f 0
cc 6
1
// jshint esversion: 8, -W104, -W069
2
3
// Base path --> assets/html
4
const electron = require('electron'),
5
  path = require('path'),
0 ignored issues
show
Unused Code introduced by
The constant path seems to be never used. Consider removing it.
Loading history...
6
  app = electron.remote.app,
7
  fs = require('fs');
8
9
const {
10
    ipcRenderer,
11
    remote,
12
    dialog
13
  } = electron;
14
15
window.$ = window.jQuery = require('jquery');
16
17
require('../js/renderer/index');
18
19
var settings = require('../js/common/settings').load();
20
21
/*
22
  $(document).ready(function() {...});
23
    When document is ready
24
 */
25
$(document).ready(function() {
26
  const {
27
    'custom.configuration': configuration
28
  } = settings;
29
30
  ipcRenderer.send('app:debug', "Document is ready");
31
32
  // Load custom configuration at startup
33
  if (fs.existsSync(app.getPath('userData') + configuration.filepath)) {
0 ignored issues
show
Bug introduced by
The variable configuration seems to be never declared. If this is a global, consider adding a /** global: configuration */ comment.

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.

Loading history...
34
    ipcRenderer.send('app:debug', "Reading persistent configurations");
35
    settings = fs.readFile(app.getPath('userData') + configuration.filepath);
36
  } else {
37
    ipcRenderer.send('app:debug', "Using default configurations");
38
  }
39
40
  startup();
41
  require('../js/renderer/navigation');
42
});
43
44
/*
45
  startup
46
    Application startup checks
47
 */
48
function startup() {
49
  const {
50
    'app.window.navigation': navigation
51
  } = settings;
52
53
  ipcRenderer.send('app:debug', "'navigation.developerTools': {0}".format(navigation.developerTools));
0 ignored issues
show
Bug introduced by
The variable navigation seems to be never declared. If this is a global, consider adding a /** global: navigation */ comment.

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.

Loading history...
54
  if (navigation.developerTools) $('#navTabDevtools').removeClass('is-force-hidden');
55
56
  ipcRenderer.send('app:debug', "'navigation.extendedcollapsed': {0}".format(navigation.extendedCollapsed));
57
  if (navigation.extendedCollapsed) {
58
    $('#navButtonExpandedmenu').toggleClass('is-active');
59
    $('.is-specialmenu').toggleClass('is-hidden');
60
  }
61
62
  ipcRenderer.send('app:debug', "'navigation.extendedmenu': {0}".format(navigation.enableExtendedMenu));
63
  if (navigation.enableExtendedMenu) $('#navButtonExpandedmenu').addClass('is-force-hidden');
64
}
65