mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 16:09:31 +03:00
fixed autoreload
This commit is contained in:
parent
c2bf2592c9
commit
d5eda8f962
@ -413,6 +413,8 @@
|
||||
?< ?=(~ t.mab)
|
||||
=+ nap=(slav %ud i.t.mab)
|
||||
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
|
||||
?: &(=(0 nap) =(~ s.sem))
|
||||
(hear:woy ~ %& %json !>((joba %reload %b %&)))
|
||||
=+ ^= cay ^- cage
|
||||
?. ?=(%json p.+.sih)
|
||||
[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
|
||||
@ -1135,6 +1137,38 @@
|
||||
heart.beat()
|
||||
'''
|
||||
::
|
||||
++ duty
|
||||
;script:'''
|
||||
if (auto)
|
||||
{
|
||||
var tries = 0;
|
||||
var cnt = 0;
|
||||
var next = "/gie/"+user+"/"+port+"/"+cnt;
|
||||
call = function() {
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', next, true);
|
||||
xhr.addEventListener('load', function() {
|
||||
if ( this.status >= 500 ) {
|
||||
return delay();
|
||||
}
|
||||
cnt++;
|
||||
if ( this.status >= 400 ) {
|
||||
document.alert("neighbor, please.");
|
||||
}
|
||||
document.location.reload();
|
||||
});
|
||||
xhr.addEventListener('error', delay);
|
||||
xhr.addEventListener('abort', delay);
|
||||
xhr.send();
|
||||
}
|
||||
delay = function() {
|
||||
setTimeout(call,1000*tries);
|
||||
tries++;
|
||||
}
|
||||
call();
|
||||
}
|
||||
'''
|
||||
::
|
||||
++ fape :: dispatch %ape
|
||||
|= [fur=(unit term) you=@p paw=path]
|
||||
^- (unit seam)
|
||||
@ -1768,7 +1802,7 @@
|
||||
|= [num=@ud app=term you=ship pax=path]
|
||||
^+ +>
|
||||
?< (~(has by sok) num)
|
||||
abet:(~(self yo num you [-(tim.bet +)]:[*sink now]) app pax)
|
||||
abet:(~(self yo num you *sink) app pax)
|
||||
::
|
||||
++ yokh :: heartbeat
|
||||
|= [num=@ud you=ship nap=@ud cnt=@ud jon=json]
|
||||
@ -1888,6 +1922,7 @@
|
||||
++ self :: request main
|
||||
|= [app=term pax=path]
|
||||
^+ +>
|
||||
=. tim.bet.siq now
|
||||
=. can.sub.siq (~(put by can.sub.siq) 0 [[our app] pax hen `nap])
|
||||
=. num.sub.siq +(num.sub.siq)
|
||||
(pass `0 [%g %show [our app] you pax])
|
||||
@ -1930,7 +1965,7 @@
|
||||
=+ pip=u.pup
|
||||
=+ ^= sip
|
||||
?. =(%apg -.som.pip) sip.pip
|
||||
[duti sip.pip]
|
||||
[duti duty sip.pip]
|
||||
?~ huq +>.$(..yo (bust 404 num))
|
||||
%= +>.$
|
||||
q.rey
|
||||
|
@ -158,8 +158,11 @@ window.urb = {
|
||||
|
||||
$this = this
|
||||
this.req(method,url,params,false,function(err,data) {
|
||||
console.log(data)
|
||||
if(cb) {
|
||||
cb.call(this,err,{status: data.status, data: data.data.data})
|
||||
} else if (data.data.reload) {
|
||||
document.location.reload()
|
||||
} else {
|
||||
fn = data.data.appl+","+data.data.path.replace(/[^\x00-\x7F]/g, "")
|
||||
+","+data.data.ship
|
||||
@ -180,3 +183,5 @@ window.urb = {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
auto = false
|
||||
|
Loading…
Reference in New Issue
Block a user