Skip to content

Commit

Permalink
reload on main changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Feb 28, 2024
1 parent 4dee047 commit ba7b67b
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 6 deletions.
129 changes: 128 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
"create-react-class": "15.7.0",
"electron": "29.0.1",
"electron-builder": "24.12.0",
"electron-log": "5.1.1",
"electron-reloader": "1.2.3",
"element-to-path": "1.2.1",
"highlight.js": "11.9.0",
"js-beautify": "1.15.1",
Expand Down Expand Up @@ -119,7 +121,6 @@
"@sentry/electron": "4.18.0",
"@webref/css": "6.12.0",
"electron-extension-installer": "1.2.0",
"electron-log": "5.1.1",
"electron-updater": "6.1.8",
"electron-window-state": "5.0.3",
"font-scanner": "0.2.1",
Expand Down
9 changes: 5 additions & 4 deletions src/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
["electron-extension-installer" :refer [REACT_DEVELOPER_TOOLS]]
["electron-extension-installer$default" :as installExtension]
["electron-log/main" :as log]
["electron-reloader"]
#_["electron-updater" :as updater]
["electron-window-state" :as window-state-keeper]
["electron" :refer [app shell ipcMain BrowserWindow clipboard nativeTheme]]
["path" :as path]
[config]
[file]))

(def main-window (atom nil))
(def loading-window (atom nil))
(defonce main-window (atom nil))
(defonce loading-window (atom nil))

(defn send-to-renderer
([action]
(send-to-renderer action nil))
([action data]
(.send (.-webContents ^js @main-window) "fromMain" (clj->js {:action action
:data data}))))
(defn load-file
(defn load
[data]
(send-to-renderer "loadDocument" data))

Expand All @@ -38,7 +39,7 @@
"openRemoteUrl" (.openExternal shell (.-data args))
;; https://www.electronjs.org/docs/api/clipboard#clipboardwritedata-type
"writeToClipboard" (.write clipboard (.-data args))
"openDocument" (file/open load-file)
"openDocument" (file/open load)
"saveDocument" (file/save (.-data args))
"export" (file/export (.-data args))))

Expand Down

0 comments on commit ba7b67b

Please sign in to comment.