Socialify

Folder ..

Viewing index.js
27 lines (22 loc) • 658.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import path from 'path'
import { shell } from 'electron'
import { Window } from 'nucleon'

export default class MainWindow extends Window {
  sourceFile() {
    return path.resolve(__dirname, '..', 'renderer', 'index.html')
  }

  enlarge() {
    this.setMinimumSize(740, 400)
    this.resize({ width: 900, height: 700 }, true)
  }

  disableNavigation() {
    this.webContents.on('new-window', async (event, navigationUrl) => {
      event.preventDefault()
      await shell.openExternal(navigationUrl)
    })

    this.webContents.on('will-navigate', event => event.preventDefault())
  }

  send(event, data) {
    this.webContents.send(event, data)
  }
}