Update fullscreen.js

This commit is contained in:
Karl Chen
2017-12-16 11:38:56 +08:00
committed by GitHub
parent faf925b858
commit d805f692ae
+8 -22
View File
@@ -88,29 +88,15 @@ class FullScreen {
}
toggle (type = 'browser') {
switch (type) {
case 'browser':
if (this.isFullScreen('browser')) {
this.cancel('browser');
if (this.isFullScreen(type)) {
this.cancel(type);
}
else {
this.request(type);
const anotherType = type === 'browser' ? 'web' : 'browser';
if (this.isFullScreen(anotherType)) {
this.cancel(anotherType);
}
else {
this.request('browser');
if (this.isFullScreen('web')) {
this.cancel('web');
}
}
break;
case 'web':
if (this.isFullScreen('web')) {
this.cancel('web');
}
else {
this.request('web');
if (this.isFullScreen('browser')) {
this.cancel('browser');
}
}
break;
}
}
}