diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-09-03 16:29:58 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-09-03 16:29:58 +0200 |
commit | 128574a300a8516cdd006472a73a020681d5694f (patch) | |
tree | c2e91884c2285ef06cd413bf6fabe0263108c702 /src/features/todos/preload.js | |
parent | bump version (diff) | |
parent | update todos app url (diff) | |
download | ferdium-app-128574a300a8516cdd006472a73a020681d5694f.tar.gz ferdium-app-128574a300a8516cdd006472a73a020681d5694f.tar.zst ferdium-app-128574a300a8516cdd006472a73a020681d5694f.zip |
Merge branch 'feature/todos' into develop
Diffstat (limited to 'src/features/todos/preload.js')
-rw-r--r-- | src/features/todos/preload.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/features/todos/preload.js b/src/features/todos/preload.js new file mode 100644 index 000000000..6e38a2ef3 --- /dev/null +++ b/src/features/todos/preload.js | |||
@@ -0,0 +1,23 @@ | |||
1 | import { ipcRenderer } from 'electron'; | ||
2 | import { IPC } from './constants'; | ||
3 | |||
4 | const debug = require('debug')('Franz:feature:todos:preload'); | ||
5 | |||
6 | debug('Preloading Todos Webview'); | ||
7 | |||
8 | let hostMessageListener = () => {}; | ||
9 | |||
10 | window.franz = { | ||
11 | onInitialize(ipcHostMessageListener) { | ||
12 | hostMessageListener = ipcHostMessageListener; | ||
13 | ipcRenderer.sendToHost(IPC.TODOS_CLIENT_CHANNEL, { action: 'todos:initialized' }); | ||
14 | }, | ||
15 | sendToHost(message) { | ||
16 | ipcRenderer.sendToHost(IPC.TODOS_CLIENT_CHANNEL, message); | ||
17 | }, | ||
18 | }; | ||
19 | |||
20 | ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => { | ||
21 | debug('Received host message', event, message); | ||
22 | hostMessageListener(message); | ||
23 | }); | ||