Files
fluxscape/packages/noodl-editor/test.js
Michael Cartner b9c60b07dc Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com>
Co-Authored-By: Johan  <4934465+joolsus@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
2024-01-26 11:52:55 +01:00

59 lines
1.5 KiB
JavaScript

const electron = require('electron');
const StorageApi = require('./src/main/src/StorageApi');
// Module to control application life.
const { app } = electron;
// Module to create native browser window.
const { BrowserWindow } = electron;
process.env.devMode = 'test';
function createWindow() {
// Create the browser window.
win = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
const remote = require('@electron/remote/main');
remote.initialize();
remote.enable(win.webContents);
// and load the index.html of the app.
win.loadURL('file:///' + process.cwd() + '/tests/SpecRunner.html');
// Open the DevTools.
win.webContents.openDevTools();
// Make sure target="_blank" opens in external browser
win.webContents.on('new-window', function (e, url) {
e.preventDefault();
electron.shell.openExternal(url);
});
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
StorageApi.setup(win);
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', function () {
createWindow();
});
// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit();
});