window.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const config = require('../config');
  2. const { BrowserWindow } = require('electron');
  3. const path = require('path');
  4. const window = {};
  5. window.new = function (file, width, height) {
  6. // Default values
  7. width = width ? width : config.window.width;
  8. height = height ? height : config.window.height;
  9. // New window
  10. const win = new BrowserWindow ({
  11. width: width,
  12. height: height,
  13. icon: path.join(__dirname, '../electronotes.png'),
  14. webPreferences: {
  15. nodeIntegration: true
  16. }
  17. });
  18. win.loadFile(file);
  19. return win;
  20. }
  21. window.simple = function (file, width, height) {
  22. // Default values
  23. width = width ? width : config.window.width;
  24. height = height ? height : config.window.height;
  25. // New window
  26. const win = new BrowserWindow ({
  27. width: width,
  28. height: height,
  29. icon: path.join(__dirname, '../electronotes.png'),
  30. webPreferences: {
  31. nodeIntegration: false
  32. }
  33. });
  34. win.loadFile(file);
  35. return win;
  36. }
  37. module.exports = window;