https://github.com/thheller/electron-cljs
Electron App Example in ClojureScript using shadow-cljs
https://github.com/thheller/electron-cljs
cljs clojurescript electron shadow-cljs
Last synced: about 2 months ago
JSON representation
Electron App Example in ClojureScript using shadow-cljs
- Host: GitHub
- URL: https://github.com/thheller/electron-cljs
- Owner: thheller
- Created: 2022-10-27T17:20:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T06:41:42.000Z (over 2 years ago)
- Last Synced: 2025-02-28T06:21:31.965Z (2 months ago)
- Topics: cljs, clojurescript, electron, shadow-cljs
- Language: Clojure
- Homepage:
- Size: 19.5 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# electron-cljs
Electron App Example using shadow-cljs.
## Build Instructions
```
npm install
npx shadow-cljs watch main renderer
npx electron .
```## Implementation Notes
Two builds are used. The `:renderer` build is a generic `:browser` build, used for the "BrowserWindow" parts which act like a normal browser. They are launched by the Electron "main" process. The `:main` build produces the output for the "main" as well as the Electron "preload". They are both node-ish contexts, so we can use a single `:npm-module` build to produce the necessary outputs.
The `app/main.js` and `app/preload.js` files act as the entry point which load and call the actual code. These are not strictly necessary, but I prefer it over having code that unconditionally runs when the namespace is loaded.
This requires using the helper files:
```
(ns demo.main)(defn ^:export init []
(do-something))
```This would not, and you would just point your `package.json` `"main"` directly at `app/js/demo.main.js` instead.
```
(ns demo.main)(do-something)
```