git ssb

2+

mixmix / ticktack



Tree: f3a07a62ed183316f08c7c0cf24dcb767afd29b1

Files: f3a07a62ed183316f08c7c0cf24dcb767afd29b1 / 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