diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-11 17:40:01 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-11 17:40:01 +0900 |
| commit | bd3d57a67f6d7c6a01516410d2322e6ffbd2f5ad (patch) | |
| tree | e5caa46997f78a61fb09a821aa0ac210784500fb /src/client | |
| parent | v4771 (diff) | |
| download | sharkey-bd3d57a67f6d7c6a01516410d2322e6ffbd2f5ad.tar.gz sharkey-bd3d57a67f6d7c6a01516410d2322e6ffbd2f5ad.tar.bz2 sharkey-bd3d57a67f6d7c6a01516410d2322e6ffbd2f5ad.zip | |
ストリーム経由でAPIにリクエストできるように
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/app/common/mios.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/app/common/mios.ts b/src/client/app/common/mios.ts index 7baf974adf..5e0c7d2f3b 100644 --- a/src/client/app/common/mios.ts +++ b/src/client/app/common/mios.ts @@ -444,23 +444,28 @@ export default class MiOS extends EventEmitter { // Append a credential if (this.isSignedIn) (data as any).i = this.i.token; - // TODO - //const viaStream = localStorage.getItem('enableExperimental') == 'true'; + const viaStream = localStorage.getItem('enableExperimental') == 'true'; return new Promise((resolve, reject) => { - /*if (viaStream) { + if (viaStream) { const stream = this.stream.borrow(); const id = Math.random().toString(); + stream.once(`api-res:${id}`, res => { - resolve(res); + if (res.res) { + resolve(res.res); + } else { + reject(res.e); + } }); + stream.send({ type: 'api', id, endpoint, data }); - } else {*/ + } else { const req = { id: uuid(), date: new Date(), |