-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
22 lines (18 loc) · 846 Bytes
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const fs = require('fs')
const { clipboard } = require('electron')
const hsimp = require('hsimp')
const gen = require('./generatePassword')
window.addEventListener('DOMContentLoaded', () => {
document.getElementById('gen').value = gen.gen()
document.getElementById('gennew').addEventListener('click', () => {
var val = gen.gen()
document.getElementById('gen').value = val
document.getElementById('time').textContent = 'It\'d take a computer around ' + hsimp(val).time + ' to crack this password. You\'re all set.'
})
document.getElementById('gencopy').addEventListener('click', () => {
clipboard.writeText(document.getElementById('gen').value)
new window.Notification('PPG copied to clipboard!', {
body: 'Your new password was copied to your clipboard.'
})
})
})