Commit 362cac1fe4ece2414ba2a455ab52e09dbd540562
Dep-eject api.fullscreen
Daan Wynen committed on 2/7/2021, 12:32:51 AMParent: a41b2de4bfaef67496e8f450f514033779a26328
Files changed
lib/depject/app/fullscreen.js | deleted |
lib/depject/index.js | changed |
lib/main-window.js | changed |
lib/fullscreen.js | added |
lib/depject/app/fullscreen.js | ||
---|---|---|
@@ -1,19 +1,0 @@ | ||
1 | -const nest = require('depnest') | |
2 | -const electron = require('electron') | |
3 | -const { Value } = require('mutant') | |
4 | - | |
5 | -exports.gives = nest('app.fullscreen') | |
6 | - | |
7 | -exports.create = function () { | |
8 | - return nest('app.fullscreen', function () { | |
9 | - const win = electron.remote.getCurrentWindow() | |
10 | - const isFullScreen = Value(win.isFullScreen()) | |
11 | - win.on('enter-full-screen', function () { | |
12 | - isFullScreen.set(true) | |
13 | - }) | |
14 | - win.on('leave-full-screen', function () { | |
15 | - isFullScreen.set(false) | |
16 | - }) | |
17 | - return isFullScreen | |
18 | - }) | |
19 | -} |
lib/depject/index.js | ||
---|---|---|
@@ -11,9 +11,8 @@ | ||
11 | 11 | obs: require('./about/obs.js'), |
12 | 12 | sync: require('./about/sync.js') |
13 | 13 | }, |
14 | 14 | app: { |
15 | - fullscreen: require('./app/fullscreen.js'), | |
16 | 15 | html: { |
17 | 16 | 'progress-notifier': require('./app/html/progress-notifier.js'), |
18 | 17 | search: require('./app/html/search.js') |
19 | 18 | }, |
lib/main-window.js | ||
---|---|---|
@@ -15,8 +15,9 @@ | ||
15 | 15 | const requireStyle = require('require-style') |
16 | 16 | const ssbUri = require('ssb-uri') |
17 | 17 | const pull = require('pull-stream') |
18 | 18 | const moment = require('moment-timezone') |
19 | +const fullscreen = require('./fullscreen.js') | |
19 | 20 | |
20 | 21 | const localTimezone = moment.tz.guess() |
21 | 22 | moment.tz.setDefault(localTimezone) |
22 | 23 | |
@@ -37,9 +38,8 @@ | ||
37 | 38 | 'page.html.render': 'first', |
38 | 39 | 'app.html.search': 'first', |
39 | 40 | 'app.html.channels': 'first', |
40 | 41 | 'app.views': 'first', |
41 | - 'app.fullscreen': 'first', | |
42 | 42 | 'app.sync.externalHandler': 'first', |
43 | 43 | 'app.html.progressNotifier': 'first', |
44 | 44 | 'about.async.latestValues': 'first', |
45 | 45 | 'profile.sheet.edit': 'first', |
@@ -193,9 +193,9 @@ | ||
193 | 193 | }) |
194 | 194 | ) |
195 | 195 | |
196 | 196 | const container = h(`MainWindow -${process.platform}`, { |
197 | - classList: [when(api.app.fullscreen(), '-fullscreen')], | |
197 | + classList: [when(fullscreen(), '-fullscreen')], | |
198 | 198 | 'ev-dragover': preventDefault, |
199 | 199 | 'ev-drop': preventDefault, |
200 | 200 | 'ev-dragstart': preventDefaultUnlessImage |
201 | 201 | }, [ |
lib/fullscreen.js | ||
---|---|---|
@@ -1,0 +1,14 @@ | ||
1 | +const electron = require('electron') | |
2 | +const { Value } = require('mutant') | |
3 | + | |
4 | +module.exports = function () { | |
5 | + const win = electron.remote.getCurrentWindow() | |
6 | + const isFullScreen = Value(win.isFullScreen()) | |
7 | + win.on('enter-full-screen', () => { | |
8 | + isFullScreen.set(true) | |
9 | + }) | |
10 | + win.on('leave-full-screen', () => { | |
11 | + isFullScreen.set(false) | |
12 | + }) | |
13 | + return isFullScreen | |
14 | +} |
Built with git-ssb-web