mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-12 13:48:12 +09:00
[Client] Refactor
This commit is contained in:
parent
38b9fed379
commit
9e75a73619
@ -9,8 +9,7 @@ riot.mixin \net do
|
|||||||
net: net
|
net: net
|
||||||
|
|
||||||
module.exports = (i, endpoint, data) ->
|
module.exports = (i, endpoint, data) ->
|
||||||
pending++
|
if ++pending == 1
|
||||||
if pending == 1
|
|
||||||
spinner := document.create-element \div
|
spinner := document.create-element \div
|
||||||
..set-attribute \id \wait
|
..set-attribute \id \wait
|
||||||
document.body.append-child spinner
|
document.body.append-child spinner
|
||||||
@ -47,9 +46,8 @@ module.exports = (i, endpoint, data) ->
|
|||||||
|
|
||||||
fetch ep, opts
|
fetch ep, opts
|
||||||
.then (res) ->
|
.then (res) ->
|
||||||
pending--
|
|
||||||
clear-timeout timer
|
clear-timeout timer
|
||||||
if pending == 0
|
if --pending == 0
|
||||||
spinner.parent-node.remove-child spinner
|
spinner.parent-node.remove-child spinner
|
||||||
|
|
||||||
if res.status == 200
|
if res.status == 200
|
||||||
|
Loading…
Reference in New Issue
Block a user