Skip to content

Commit 1392ccb

Browse files
authored
docs: update electron example (#555)
Adds configuration to server creation and updates deps
1 parent f74a640 commit 1392ccb

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

examples/electron-asar/app.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ ipcMain.on('start', async ({ sender }) => {
2222
console.log('starting disposable IPFS')
2323
sender.send('message', 'starting disposable IPFS')
2424
try {
25-
const s = createServer()
25+
const s = createServer({
26+
host: '127.0.0.1',
27+
port: 43134
28+
}, {
29+
type: 'go',
30+
ipfsBin: require('go-ipfs').path(),
31+
ipfsHttpModule: require('ipfs-http-client')
32+
})
2633
await s.start()
2734
const node = await createController({
2835
type: 'go',
29-
ipfsBin: require('go-ipfs').path()
36+
ipfsHttpModule: require('ipfs-http-client')
3037
})
3138
console.log('get id')
3239
sender.send('message', 'get id')
@@ -37,7 +44,7 @@ ipcMain.on('start', async ({ sender }) => {
3744
await node.stop()
3845
await s.stop()
3946
} catch (error) {
40-
sender.send('id', JSON.stringify(error.message))
47+
sender.send('error', JSON.stringify(error.message))
4148
console.log(error)
4249
}
4350
})

examples/electron-asar/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"private": true,
44
"main": "./app.js",
55
"dependencies": {
6-
"go-ipfs": "^0.6.0",
7-
"ipfs": "^0.43.0",
6+
"go-ipfs": "^0.7.0",
7+
"ipfs-http-client": "^47.0.1",
88
"ipfsd-ctl": "file:../.."
99
},
1010
"devDependencies": {
11-
"electron": "^6.0.12",
12-
"electron-packager": "^14.0.6"
11+
"electron": "^10.1.4",
12+
"electron-packager": "^15.1.0"
1313
},
1414
"scripts": {
1515
"start": "electron .",

0 commit comments

Comments
 (0)