summaryrefslogtreecommitdiff
path: root/src/web/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo⭐️ <Syuilotan@yahoo.co.jp>2017-02-03 05:14:07 +0900
committerGitHub <noreply@github.com>2017-02-03 05:14:07 +0900
commit318d9195c05f9a896384385ca0d058f969a09008 (patch)
tree661dffa11a77598e7cc821984f6ac0bfd0325d3e /src/web/app/common/scripts
parentRefactoring (diff)
downloadsharkey-318d9195c05f9a896384385ca0d058f969a09008.tar.gz
sharkey-318d9195c05f9a896384385ca0d058f969a09008.tar.bz2
sharkey-318d9195c05f9a896384385ca0d058f969a09008.zip
Refactor
Diffstat (limited to 'src/web/app/common/scripts')
-rw-r--r--src/web/app/common/scripts/api.ls11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/web/app/common/scripts/api.ls b/src/web/app/common/scripts/api.ls
index 2292902a91..7ebd645db4 100644
--- a/src/web/app/common/scripts/api.ls
+++ b/src/web/app/common/scripts/api.ls
@@ -10,7 +10,11 @@ riot.mixin \net do
module.exports = (i, endpoint, data) ->
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
body = []
@@ -36,11 +40,6 @@ module.exports = (i, endpoint, data) ->
then 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) ->
timer = set-timeout ->
net.trigger \detected-slow-network