This commit is contained in:
syuilo 2018-04-12 06:18:55 +09:00
parent 70433469a1
commit cca9963a9a
2 changed files with 14 additions and 2 deletions

View file

@ -444,7 +444,7 @@ export default class MiOS extends EventEmitter {
// Append a credential // Append a credential
if (this.isSignedIn) (data as any).i = this.i.token; if (this.isSignedIn) (data as any).i = this.i.token;
const viaStream = localStorage.getItem('enableExperimental') == 'true'; const viaStream = localStorage.getItem('apiViaStream') ? localStorage.getItem('apiViaStream') == 'true' : true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (viaStream) { if (viaStream) {
@ -452,6 +452,8 @@ export default class MiOS extends EventEmitter {
const id = Math.random().toString(); const id = Math.random().toString();
stream.once(`api-res:${id}`, res => { stream.once(`api-res:${id}`, res => {
if (--pending === 0) spinner.parentNode.removeChild(spinner);
if (res.res) { if (res.res) {
resolve(res.res); resolve(res.res);
} else { } else {
@ -503,7 +505,7 @@ export default class MiOS extends EventEmitter {
reject(body.error); reject(body.error);
} }
}).catch(reject); }).catch(reject);
/*}*/ }
}); });
} }

View file

@ -26,6 +26,12 @@
<mk-switch v-model="autoPopout" text="ウィンドウの自動ポップアウト"> <mk-switch v-model="autoPopout" text="ウィンドウの自動ポップアウト">
<span>ウィンドウが開かれるときポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトしますこの設定はブラウザに記憶されます</span> <span>ウィンドウが開かれるときポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトしますこの設定はブラウザに記憶されます</span>
</mk-switch> </mk-switch>
<details>
<summary>詳細設定</summary>
<mk-switch v-model="apiViaStream" text="ストリームを経由したAPIリクエスト">
<span>この設定をオンにするとwebsocket接続を経由してAPIリクエストが行われます(パフォーマンス向上が期待できます)オフにするとネイティブの fetch APIが利用されますこの設定はこのデバイスのみ有効です</span>
</mk-switch>
</details>
</section> </section>
<section class="web" v-show="page == 'web'"> <section class="web" v-show="page == 'web'">
@ -223,6 +229,7 @@ export default Vue.extend({
checkingForUpdate: false, checkingForUpdate: false,
enableSounds: localStorage.getItem('enableSounds') == 'true', enableSounds: localStorage.getItem('enableSounds') == 'true',
autoPopout: localStorage.getItem('autoPopout') == 'true', autoPopout: localStorage.getItem('autoPopout') == 'true',
apiViaStream: localStorage.getItem('apiViaStream') ? localStorage.getItem('apiViaStream') == 'true' : true,
soundVolume: localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) : 100, soundVolume: localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) : 100,
lang: localStorage.getItem('lang') || '', lang: localStorage.getItem('lang') || '',
preventUpdate: localStorage.getItem('preventUpdate') == 'true', preventUpdate: localStorage.getItem('preventUpdate') == 'true',
@ -240,6 +247,9 @@ export default Vue.extend({
autoPopout() { autoPopout() {
localStorage.setItem('autoPopout', this.autoPopout ? 'true' : 'false'); localStorage.setItem('autoPopout', this.autoPopout ? 'true' : 'false');
}, },
apiViaStream() {
localStorage.setItem('apiViaStream', this.apiViaStream ? 'true' : 'false');
},
enableSounds() { enableSounds() {
localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false'); localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false');
}, },