Skip to content

Commit

Permalink
fix: prope electorn app
Browse files Browse the repository at this point in the history
  • Loading branch information
darekf77 committed Apr 23, 2024
1 parent b625b98 commit 7710529
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.vscode
dist/
src/
/dist
/src
/docs
/preview
/tests
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
"@ngx-formly/material": "6.1.8",
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@parcel/watcher": "2.3.0",
"@sweetalert2/ngx-sweetalert2": "12.1.0",
"@testdeck/jest": "0.3.3",
"@testdeck/mocha": "0.3.3",
Expand Down Expand Up @@ -212,7 +211,7 @@
"firedev-storage": "~16.5.19",
"firedev-type-sql": "~16.5.19",
"firedev-typeorm": "~16.5.21",
"firedev-ui": "~16.5.19",
"firedev-ui": "~16.5.20",
"fkill": "6.1.0",
"font-awesome": "4.7.0",
"form-data": "4.0.0",
Expand All @@ -229,7 +228,7 @@
"image-focus": "1.2.1",
"immer": "10.0.2",
"immutable": "4.3.0",
"incremental-compiler": "~16.5.37",
"incremental-compiler": "~16.5.38",
"inquirer": "7.3.3",
"inquirer-autocomplete-prompt": "1.3.0",
"is-elevated": "3.0.0",
Expand All @@ -244,7 +243,7 @@
"joi": "17.9.2",
"jscodeshift": "0.6.3",
"json-stringify-safe": "5.0.1",
"json10": "~16.5.18",
"json10": "~16.5.19",
"json10-writer": "~16.5.28",
"json5": "2.2.1",
"json5-writer": "0.2.0",
Expand All @@ -254,7 +253,7 @@
"localforage": "1.10.0",
"lockfile": "1.0.4",
"lodash": "4.17.20",
"lodash-walk-object": "~16.5.18",
"lodash-walk-object": "~16.5.19",
"lowdb": "1.0.0",
"magic-renamer": "~16.5.20",
"material-design-icons": "3.0.1",
Expand All @@ -268,9 +267,9 @@
"ng-in-viewport": "15.0.2",
"ng-lock": "16.0.1",
"ng-packagr": "16.0.1",
"ng-talkback": "~16.5.19",
"ng-talkback": "~16.5.20",
"ng2-logger": "~16.5.30",
"ng2-rest": "~16.5.18",
"ng2-rest": "~16.5.19",
"ngx-ace-wrapper": "14.0.0",
"ngx-editor": "15.3.0",
"ngx-highlightjs": "9.0.0",
Expand All @@ -283,7 +282,7 @@
"ngx-scrolltop": "6.0.0",
"ngx-store": "3.1.1",
"ngx-typed-js": "2.1.1",
"node-cli-tester": "~16.5.19",
"node-cli-tester": "~16.5.20",
"node-localstorage": "2.1.6",
"node-notifier": "6.0.0",
"node-polyfill-webpack-plugin": "2.0.1",
Expand All @@ -310,7 +309,7 @@
"q": "1.5.1",
"rallax.js": "2.0.4",
"randomcolor": "0.5.3",
"record-replay-req-res-scenario": "~16.5.18",
"record-replay-req-res-scenario": "~16.5.19",
"reflect-metadata": "0.1.10",
"rimraf": "2.6.2",
"rxjs": "~7.8.0",
Expand All @@ -329,7 +328,7 @@
"systeminformation": "3.45.7",
"task.js": "0.1.5",
"threads": "1.7.0",
"tnp-cli": "~16.5.18",
"tnp-cli": "~16.5.19",
"tnp-config": "~16.5.39",
"tnp-core": "~16.6.36",
"tnp-db": "~16.5.20",
Expand All @@ -348,7 +347,7 @@
"uuid": "8.3.2",
"validator": "9.2.0",
"video.js": "8.3.0",
"vpn-split": "~16.5.21",
"vpn-split": "~16.5.22",
"watch": "1.0.2",
"webpack": "~5.80",
"webpack-dev-middleware": "~6.0.2",
Expand Down
68 changes: 36 additions & 32 deletions src/app.electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fse
} from 'tnp-core';
//#region @backend
import { app, BrowserWindow, screen } from 'electron';
import start from './app';

let win: BrowserWindow | null = null;
const args = process.argv.slice(1);
Expand All @@ -23,21 +24,20 @@ win = new BrowserWindow({
x: 0,
y: 0,
autoHideMenuBar: true,
width: size.width / 1.5,
height: size.height / 1.5,
width: size.width * (3/4),
height: size.height * (3/4),
webPreferences: {
nodeIntegration: true,
allowRunningInsecureContent: (serve),
contextIsolation: false,
},
});

win.webContents.openDevTools();

if (serve) {
const debug = require('electron-debug');
debug();


require('electron-reloader')(module);
win.loadURL('http://localhost:' + (websql ? CLIENT_DEV_WEBSQL_APP_PORT : CLIENT_DEV_NORMAL_APP_PORT));
} else {
Expand All @@ -53,6 +53,8 @@ if (serve) {
win.loadURL(url.href);
}

win.webContents.openDevTools();

// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store window
Expand All @@ -65,34 +67,36 @@ return win;
}

async function startElectron() {
try {
// 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.
// Added 400 ms to fix the black background issue while using transparent window. More detais at https://github.com/electron/electron/issues/15947
app.on('ready', () => setTimeout(createWindow, 400));

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});

} catch (e) {
// Catch Error
// throw e;
}
await start();
try {
// 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.
// Added 400 ms to fix the black background issue while using transparent window. More detais at https://github.com/electron/electron/issues/15947
// app.on('ready', () => setTimeout(createWindow, 400));
setTimeout(createWindow, 400)

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});

} catch (e) {
// Catch Error
throw e;
}
}

startElectron();
Expand Down
10 changes: 5 additions & 5 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ async function start() {
//#endregion
});
//#region @backend
if (Firedev.isNode) {
context.node.app.get('/hello', (req, res) => {
res.send('Hello static-columns')
})
}
// if (Firedev.isNode) {
// context.node.app.get('/hello', (req, res) => {
// res.send('Hello static-columns')
// })
// }
//#endregion
}
//#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/app/preview/preview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</column>
<column grow
class="header">
<img src="src/assets/logo.png"
<img src="/src/assets/logo.png"
height="30px">
<span>
This is a demo of <strong>static-columns</strong> angular component.
Expand Down

0 comments on commit 7710529

Please sign in to comment.