git ssb

2+

mixmix / ticktack



Tree: db07f3aa11263d691a9cda69238563a05b7c440e

Files: db07f3aa11263d691a9cda69238563a05b7c440e / app / sync / initialize / zoomMemory.js

1038 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)
34 getCurrentWebContents().setZoomFactor(zoomFactor)
35
36 var bounds = api.settings.sync.get('ticktack.electron.windowBounds')
37 if (bounds)
38 getCurrentWindow().setBounds(bounds)
39 }
40}
41
42

Built with git-ssb-web