https://github.com/lawondyss/svelte-electron-template
Template for Electron app with Svelte
https://github.com/lawondyss/svelte-electron-template
electron electron-app electronjs rollup svelte sveltejs template template-project
Last synced: 3 months ago
JSON representation
Template for Electron app with Svelte
- Host: GitHub
- URL: https://github.com/lawondyss/svelte-electron-template
- Owner: Lawondyss
- License: mit
- Created: 2022-01-08T10:31:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-11T09:11:59.000Z (over 4 years ago)
- Last Synced: 2025-01-15T18:38:38.606Z (over 1 year ago)
- Topics: electron, electron-app, electronjs, rollup, svelte, sveltejs, template, template-project
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte-electron-template
A [Electron](https://www.electronjs.org/) app template with [Svelte](https://svelte.dev/) framework.
## How to get started
#### 1) Copy template
**degit**
```
npx degit github:lawondyss/svelte-electron-template
```
or
**git**
```
git clone https://github.com/Lawondyss/svelte-electron-template.git
```
#### 2) Initialization
```
cd
```
**npm**
```
npm install
npm run dev
```
or
**yarn**
```
yarn install
yarn run dev
```
#### 3) Profit

## Architecture
```
backend/
- api.js -> create comunication between backend and frontend
- handlers.js -> backend handlers for calling channels from frontend
- index.js -> Electron initialization
- preload.js -> calling before starting frontend
frontend/
- app.js -> Svelte initialization
- App.svelte -> Svelte main component
public/
- global.css -> global CSS styles
- index.html -> main HTML file of application
```
## Handlers
This methods run on backend (NodeJS) of application and returns results for frontend. Methods are calling from exposed function `window.api()` in frontend.
First parameter of `window.api()` is name of handler. All others parameters are passed to handler.
Calling a `window.api()` returns a promise and value for `then()` is result of handler.