Give macOS an extra 300ms to open and fullscreen a webview
This commit is contained in:
parent
f8fc9fded6
commit
45f96e6537
|
@ -17,7 +17,7 @@ function padded_frame(i) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
class WebView {
|
class WebView {
|
||||||
constructor() {
|
constructor(platform) {
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.showing = false;
|
this.showing = false;
|
||||||
this.digitalWindow = new BrowserWindow({
|
this.digitalWindow = new BrowserWindow({
|
||||||
|
@ -39,7 +39,8 @@ class WebView {
|
||||||
this.digitalWindow = null;
|
this.digitalWindow = null;
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
this.digitalWindow.hide();
|
//this.digitalWindow.hide();
|
||||||
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
async open() {
|
async open() {
|
||||||
this.digitalWindow.show();
|
this.digitalWindow.show();
|
||||||
|
@ -47,6 +48,9 @@ class WebView {
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
await this.digitalWindow.setFullScreen(true);
|
await this.digitalWindow.setFullScreen(true);
|
||||||
await delay_1.delay(300);
|
await delay_1.delay(300);
|
||||||
|
if (this.platform === 'osx') {
|
||||||
|
await delay_1.delay(300); //give macs an extra 300ms to open fullscreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async show(src) {
|
async show(src) {
|
||||||
if (!this.digitalWindow) {
|
if (!this.digitalWindow) {
|
||||||
|
@ -150,7 +154,7 @@ class Display {
|
||||||
async open() {
|
async open() {
|
||||||
//if (this.platform !== 'nix') {
|
//if (this.platform !== 'nix') {
|
||||||
if (!this.wv || !this.wv.opened) {
|
if (!this.wv || !this.wv.opened) {
|
||||||
this.wv = new WebView();
|
this.wv = new WebView(this.platform);
|
||||||
await this.wv.open();
|
await this.wv.open();
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,7 +17,7 @@ function padded_frame(i) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
class WebView {
|
class WebView {
|
||||||
constructor() {
|
constructor(platform) {
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.showing = false;
|
this.showing = false;
|
||||||
this.digitalWindow = new BrowserWindow({
|
this.digitalWindow = new BrowserWindow({
|
||||||
|
@ -39,7 +39,8 @@ class WebView {
|
||||||
this.digitalWindow = null;
|
this.digitalWindow = null;
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
this.digitalWindow.hide();
|
//this.digitalWindow.hide();
|
||||||
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
async open() {
|
async open() {
|
||||||
this.digitalWindow.show();
|
this.digitalWindow.show();
|
||||||
|
@ -47,6 +48,9 @@ class WebView {
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
await this.digitalWindow.setFullScreen(true);
|
await this.digitalWindow.setFullScreen(true);
|
||||||
await delay_1.delay(300);
|
await delay_1.delay(300);
|
||||||
|
if (this.platform === 'osx') {
|
||||||
|
await delay_1.delay(300); //give macs an extra 300ms to open fullscreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async show(src) {
|
async show(src) {
|
||||||
if (!this.digitalWindow) {
|
if (!this.digitalWindow) {
|
||||||
|
@ -150,7 +154,7 @@ class Display {
|
||||||
async open() {
|
async open() {
|
||||||
//if (this.platform !== 'nix') {
|
//if (this.platform !== 'nix') {
|
||||||
if (!this.wv || !this.wv.opened) {
|
if (!this.wv || !this.wv.opened) {
|
||||||
this.wv = new WebView();
|
this.wv = new WebView(this.platform);
|
||||||
await this.wv.open();
|
await this.wv.open();
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,7 +17,7 @@ function padded_frame(i) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
class WebView {
|
class WebView {
|
||||||
constructor() {
|
constructor(platform) {
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.showing = false;
|
this.showing = false;
|
||||||
this.digitalWindow = new BrowserWindow({
|
this.digitalWindow = new BrowserWindow({
|
||||||
|
@ -39,7 +39,8 @@ class WebView {
|
||||||
this.digitalWindow = null;
|
this.digitalWindow = null;
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
this.digitalWindow.hide();
|
//this.digitalWindow.hide();
|
||||||
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
async open() {
|
async open() {
|
||||||
this.digitalWindow.show();
|
this.digitalWindow.show();
|
||||||
|
@ -47,6 +48,9 @@ class WebView {
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
await this.digitalWindow.setFullScreen(true);
|
await this.digitalWindow.setFullScreen(true);
|
||||||
await delay_1.delay(300);
|
await delay_1.delay(300);
|
||||||
|
if (this.platform === 'osx') {
|
||||||
|
await delay_1.delay(300); //give macs an extra 300ms to open fullscreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async show(src) {
|
async show(src) {
|
||||||
if (!this.digitalWindow) {
|
if (!this.digitalWindow) {
|
||||||
|
@ -150,7 +154,7 @@ class Display {
|
||||||
async open() {
|
async open() {
|
||||||
//if (this.platform !== 'nix') {
|
//if (this.platform !== 'nix') {
|
||||||
if (!this.wv || !this.wv.opened) {
|
if (!this.wv || !this.wv.opened) {
|
||||||
this.wv = new WebView();
|
this.wv = new WebView(this.platform);
|
||||||
await this.wv.open();
|
await this.wv.open();
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,9 @@ class WebView {
|
||||||
private digitalWindow : any;
|
private digitalWindow : any;
|
||||||
public opened : boolean = false;
|
public opened : boolean = false;
|
||||||
public showing : boolean = false;
|
public showing : boolean = false;
|
||||||
constructor() {
|
private platform : string;
|
||||||
|
|
||||||
|
constructor (platform : string) {
|
||||||
this.digitalWindow = new BrowserWindow({
|
this.digitalWindow = new BrowserWindow({
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
@ -45,7 +47,8 @@ class WebView {
|
||||||
this.digitalWindow = null;
|
this.digitalWindow = null;
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
this.digitalWindow.hide();
|
//this.digitalWindow.hide();
|
||||||
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
async open () {
|
async open () {
|
||||||
this.digitalWindow.show();
|
this.digitalWindow.show();
|
||||||
|
@ -53,6 +56,9 @@ class WebView {
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
await this.digitalWindow.setFullScreen(true);
|
await this.digitalWindow.setFullScreen(true);
|
||||||
await delay(300);
|
await delay(300);
|
||||||
|
if (this.platform === 'osx') {
|
||||||
|
await delay(300); //give macs an extra 300ms to open fullscreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async show (src : string) {
|
async show (src : string) {
|
||||||
if (!this.digitalWindow) {
|
if (!this.digitalWindow) {
|
||||||
|
@ -164,7 +170,7 @@ class Display {
|
||||||
public async open () {
|
public async open () {
|
||||||
//if (this.platform !== 'nix') {
|
//if (this.platform !== 'nix') {
|
||||||
if (!this.wv || !this.wv.opened) {
|
if (!this.wv || !this.wv.opened) {
|
||||||
this.wv = new WebView();
|
this.wv = new WebView(this.platform);
|
||||||
await this.wv.open()
|
await this.wv.open()
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
|
|
Loading…
Reference in New Issue