git ssb

2+

mixmix / ticktack



Tree: 9ae1c46f226c40c608560b66d0b5ca42ecce151b

Files: 9ae1c46f226c40c608560b66d0b5ca42ecce151b / app / sync / initialize / zoomMemory.js

1036 bytesRaw
1const nest = require('depnest')
2const electron = require('electron')
3
4exports.gives = nest('app.sync.initialize')
5
6exports.needs = nest({
7 'settings.sync.get': 'first',
8 'settings.sync.set': 'first'
9})
10
11exports.create = (api) => {
12 return nest('app.sync.initialize', zoomMemory)
13
14 function zoomMemory () {
15 const { getCurrentWebContents, getCurrentWindow } = electron.remote
16
17 window.addEventListener('resize', () => {
18 var wc = getCurrentWebContents()
19 wc && wc.getZoomFactor(zf => {
20 console.log(zf)
21 api.settings.sync.set({
22 ticktack: {
23 electron: {
24 zoomFactor: zf,
25 windowBounds: getCurrentWindow().getBounds()
26 }
27 }
28 })
29 })
30 })
31
32 var zoomFactor = api.settings.sync.get('ticktack.electron.zoomFactor')
33 if (zoomFactor) { getCurrentWebContents().setZoomFactor(zoomFactor) }
34
35 var bounds = api.settings.sync.get('ticktack.electron.windowBounds')
36 if (bounds) { getCurrentWindow().setBounds(bounds) }
37 }
38}
39

Built with git-ssb-web