(fn)
| 5 | var wsHost = ((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + window.location.pathname; |
| 6 | |
| 7 | function asPromise(fn){ |
| 8 | return new Promise((resolve,reject) => fn((err,res) => err ? reject(err) : resolve(res))) |
| 9 | } |
| 10 | |
| 11 | function asPromiseAndJSON (fn) { |
| 12 | return asPromise(fn).then((res) => res.body); |