12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- const config = require('../config');
- const { BrowserWindow } = require('electron');
- const path = require('path');
- const window = {};
- window.hidden = function (file) {
- const win = new BrowserWindow({
- width: 0,
- height: 0,
- show: false,
- webPreferences: {
- nodeIntegration: true
- }
- });
- if (file) {
- win.loadFile(file);
- }
- return win;
- }
- window.new = function (file, width, height) {
- // Default values
- width = width ? width : config.window.width;
- height = height ? height : config.window.height;
- // New window
- const win = new BrowserWindow ({
- width: width,
- height: height,
- icon: path.join(__dirname, '../electronotes.png'),
- webPreferences: {
- nodeIntegration: true
- }
- });
- win.loadFile(file);
- return win;
- }
- window.simple = function (file, width, height) {
- // Default values
- width = width ? width : config.window.width;
- height = height ? height : config.window.height;
- // New window
- const win = new BrowserWindow ({
- width: width,
- height: height,
- icon: path.join(__dirname, '../electronotes.png'),
- webPreferences: {
- nodeIntegration: false
- }
- });
- win.loadFile(file);
- return win;
- }
- window.frameless = function (file, parent, width, height) {
- // Default values
- width = width ? width : config.window.width;
- height = height ? height : config.window.height;
- // Options
- const opts = {
- width: width,
- height: height,
- frame: false,
- icon: path.join(__dirname, '../electronotes.png'),
- webPreferences: {
- nodeIntegration: true
- }
- }
- // Add parent if have one
- if (parent) {
- opts.parent = parent;
- }
- // New window
- const win = new BrowserWindow (opts);
- win.loadFile(file);
- return win;
- }
- module.exports = window;
|