Skip to content

Commit 5f7ce94

Browse files
committed
Implement host listener controls for boost hub web view
1 parent 21ccfab commit 5f7ce94

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

static/boosthub-preload.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ function sendToHost(channel, ...args) {
55
ipcRenderer.sendToHost(channel, ...args)
66
}
77

8+
function addHostListener(channel, listener) {
9+
ipcRenderer.addListener(channel, listener)
10+
}
11+
12+
function removeHostListener(channel, listener) {
13+
ipcRenderer.removeListener(channel, listener)
14+
}
15+
16+
function removeAllHostListeners(channel) {
17+
ipcRenderer.removeAllListeners(channel)
18+
}
19+
820
function convertHtmlStringToPdfBlob(htmlString, printOptions) {
921
return new Promise((resolve, reject) => {
1022
const encodedStr = encodeURIComponent(htmlString)
@@ -40,3 +52,7 @@ function convertHtmlStringToPdfBlob(htmlString, printOptions) {
4052
window.__ELECTRON_ONLY__ = {}
4153
window.__ELECTRON_ONLY__.sendToHost = sendToHost
4254
window.__ELECTRON_ONLY__.convertHtmlStringToPdfBlob = convertHtmlStringToPdfBlob
55+
56+
window.__ELECTRON_ONLY__.addHostListener = addHostListener
57+
window.__ELECTRON_ONLY__.removeHostListener = removeHostListener
58+
window.__ELECTRON_ONLY__.removeAllHostListeners = removeAllHostListeners

0 commit comments

Comments
 (0)