Compare commits

..

2 Commits

Author SHA1 Message Date
kts of kettek (POWERQWACK) 6d82f5f5b3 Testing code 2021-02-16 06:36:19 -08:00
kts of kettek (POWERQWACK) 488b7a5e27 Implement full electron functionality
I have also structured the project so electron is fairly isolated.
2021-02-16 06:36:12 -08:00
8 changed files with 33 additions and 9 deletions

View File

@ -6,12 +6,13 @@ function createWindow() {
width: 800,
height: 600,
webPreferences: {
contextIsolation: true,
contextIsolation: false,
nodeIntegration: true,
},
});
if (process.env.NODE_ENV === 'production') {
win.loadFile('./build/index.html');
win.loadFile('./index.html');
} else {
win.loadURL('http://localhost:8080');
}

View File

@ -0,0 +1,3 @@
{
"main": "main.js"
}

9
app/package-lock.json generated
View File

@ -272,6 +272,15 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.1"
}
},
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",

View File

@ -1,18 +1,18 @@
{
"main": "electron.js",
"scripts": {
"start": "snowpack dev",
"build": "snowpack build",
"snowpack-dev": "snowpack dev --open none",
"electron-dev": "concurrently \"npm run snowpack-dev\" \"npm run electron-start\"",
"electron-start": "electron .",
"electron-prod": "cross-env NODE_ENV=production electron ."
"electron-start": "electron ./build",
"electron-prod": "cross-env NODE_ENV=production electron ./build"
},
"devDependencies": {
"@snowpack/plugin-svelte": "^3.5.2",
"@snowpack/plugin-typescript": "^1.2.1",
"@tsconfig/svelte": "^1.0.10",
"concurrently": "^5.3.0",
"cross-env": "^7.0.3",
"electron": "^11.2.3",
"snowpack": "^3.0.1",
"svelte-preprocess": "^4.6.9",

View File

@ -4,10 +4,10 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Accord" />
<link rel="stylesheet" type="text/css" href="/index.css" />
<link rel="stylesheet" type="text/css" href="./index.css" />
<title>Accord</title>
</head>
<body>
<script type="module" src="/dist/index.js"></script>
<script type="module" src="./dist/index.js"></script>
</body>
</html>

View File

@ -4,6 +4,7 @@ module.exports = {
/* ... */
// 'build directory'
public: '/',
electron: '/',
src: '/dist',
},
plugins: [

View File

@ -1,12 +1,16 @@
<script lang='typescript'>
import { onMount } from 'svelte'
const { spawn } = require('child_process')
import AppHeader from './components/AppHeader.svelte'
let count: number = 0
onMount(() => {
const interval = setInterval(() => count++, 1000)
// TODO: Spin up service
return () => {
clearInterval(interval)
// TODO: Close service
}
})
</script>
@ -15,7 +19,10 @@
</style>
<div class="App">
<header class="App-header">
<AppHeader/>
<nav>
</nav>
<main>
<p>Page has been open for <code>{count}</code> seconds.</p>
</header>
</main>
</div>

View File

@ -0,0 +1,3 @@
<header>
Application Header
</header>