git ssb

2+

mixmix / ticktack



Tree: 5f86bdb837a971c779cc9be81fd7c8e39090a252

Files: 5f86bdb837a971c779cc9be81fd7c8e39090a252 / app / sync / initialize / zoomMemory.js

1081 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 console.log('> initialise: window form')
16 const { getCurrentWebContents, getCurrentWindow } = electron.remote
17
18 window.addEventListener('resize', () => {
19 var wc = getCurrentWebContents()
20 wc && wc.getZoomFactor(zf => {
21 console.log(zf)
22 api.settings.sync.set({
23 ticktack: {
24 electron: {
25 zoomFactor: zf,
26 windowBounds: getCurrentWindow().getBounds()
27 }
28 }
29 })
30 })
31 })
32
33 var zoomFactor = api.settings.sync.get('ticktack.electron.zoomFactor')
34 if (zoomFactor) { getCurrentWebContents().setZoomFactor(zoomFactor) }
35
36 var bounds = api.settings.sync.get('ticktack.electron.windowBounds')
37 if (bounds) { getCurrentWindow().setBounds(bounds) }
38 }
39}
40

Built with git-ssb-web