mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 09:33:08 +02:00
Refactor
This commit is contained in:
parent
5a18d4bc80
commit
318d9195c0
1 changed files with 5 additions and 6 deletions
|
@ -10,7 +10,11 @@ riot.mixin \net do
|
||||||
|
|
||||||
module.exports = (i, endpoint, data) ->
|
module.exports = (i, endpoint, data) ->
|
||||||
pending++
|
pending++
|
||||||
|
if pending == 1
|
||||||
|
spinner := document.create-element \div
|
||||||
|
..set-attribute \id \wait
|
||||||
|
document.body.append-child spinner
|
||||||
|
|
||||||
if i? and typeof i == \object then i = i.token
|
if i? and typeof i == \object then i = i.token
|
||||||
|
|
||||||
body = []
|
body = []
|
||||||
|
@ -36,11 +40,6 @@ module.exports = (i, endpoint, data) ->
|
||||||
then endpoint
|
then endpoint
|
||||||
else "#{CONFIG.api.url}/#{endpoint}"
|
else "#{CONFIG.api.url}/#{endpoint}"
|
||||||
|
|
||||||
if pending == 1
|
|
||||||
spinner := document.create-element \div
|
|
||||||
..set-attribute \id \wait
|
|
||||||
document.body.append-child spinner
|
|
||||||
|
|
||||||
new Promise (resolve, reject) ->
|
new Promise (resolve, reject) ->
|
||||||
timer = set-timeout ->
|
timer = set-timeout ->
|
||||||
net.trigger \detected-slow-network
|
net.trigger \detected-slow-network
|
||||||
|
|
Loading…
Reference in a new issue