Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Every little picofarad has a nanohenry all its own. -- Don Vonada


devel / comp.lang.javascript / Re: Serialise setInterval

SubjectAuthor
* Serialise setIntervalJonas Thörnvall
`* Re: Serialise setIntervalJonas Thörnvall
 `* Re: Serialise setIntervalBen Bacarisse
  +- Re: Serialise setIntervalJonas Thörnvall
  +- Re: Serialise setIntervalJonas Thörnvall
  `* Re: Serialise setIntervalJonas Thörnvall
   `* Re: Serialise setIntervalJonas Thörnvall
    `* Re: Serialise setIntervalJonas Thörnvall
     +* Re: Serialise setIntervalJonas Thörnvall
     |`* Re: Serialise setIntervalBen Bacarisse
     | +* Re: Serialise setIntervalJonas Thörnvall
     | |`* Re: Serialise setIntervalBen Bacarisse
     | | `- Re: Serialise setIntervalJonas Thörnvall
     | `* Re: Serialise setIntervalJonas Thörnvall
     |  `* Re: Serialise setIntervalJohn G Harris
     |   `* Re: Serialise setIntervalJonas Thörnvall
     |    `* Re: Serialise setIntervalJonas Thörnvall
     |     `- Re: Serialise setIntervalJonas Thörnvall
     `- Re: Serialise setIntervalJonas Thörnvall

1
Serialise setInterval

<6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16931&group=comp.lang.javascript#16931

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a37:63d2:: with SMTP id x201mr1356292qkb.202.1621454714265;
Wed, 19 May 2021 13:05:14 -0700 (PDT)
X-Received: by 2002:aca:f5d0:: with SMTP id t199mr875820oih.50.1621454713962;
Wed, 19 May 2021 13:05:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Wed, 19 May 2021 13:05:13 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
Subject: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Wed, 19 May 2021 20:05:14 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Jonas Thörnvall - Wed, 19 May 2021 20:05 UTC

Can someone give a minimalistic example on howto serialise two setIntervals?
"To some sort of accuracy"

Re: Serialise setInterval

<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16932&group=comp.lang.javascript#16932

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a37:9b51:: with SMTP id d78mr1370710qke.441.1621456949657;
Wed, 19 May 2021 13:42:29 -0700 (PDT)
X-Received: by 2002:a4a:250e:: with SMTP id g14mr988472ooa.31.1621456949339;
Wed, 19 May 2021 13:42:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Wed, 19 May 2021 13:42:29 -0700 (PDT)
In-Reply-To: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Wed, 19 May 2021 20:42:29 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Wed, 19 May 2021 20:42 UTC

onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> Can someone give a minimalistic example on howto serialise two setIntervals?
> "To some sort of accuracy"
Can someone tell why this approach would not work?
function countIn(){
REALTIME=(performance.now()-browserLoadTIME)-2400;
if (REALTIME<0){
stopCount=setInterval(countIn,600);
} else {
clearInterval(stopCount);
stopRec=setInterval(recSomeNotes,5);
}
}

I consider myself logical but i just can't wrap my head around some of the logic within javascript

Re: Serialise setInterval

<87bl96w4f0.fsf@bsb.me.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16933&group=comp.lang.javascript#16933

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.javascript
Subject: Re: Serialise setInterval
Date: Thu, 20 May 2021 03:00:03 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <87bl96w4f0.fsf@bsb.me.uk>
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="40361b37221cb96cb28693c773a02343";
logging-data="27806"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+1Xv+1TDnsiYbHdq7V/gtFMMh1k9Jyuc="
Cancel-Lock: sha1:STtMN8rpxP382NHTyjCLTz+sKeE=
sha1:jBPa1n0AGoKzINuqlk0JGBetCkk=
X-BSB-Auth: 1.2a9df388cd39680c5995.20210520030003BST.87bl96w4f0.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 20 May 2021 02:00 UTC

Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
>> Can someone give a minimalistic example on howto serialise two setIntervals?
>> "To some sort of accuracy"
> Can someone tell why this approach would not work?
> function countIn(){
> REALTIME=(performance.now()-browserLoadTIME)-2400;
> if (REALTIME<0){
> stopCount=setInterval(countIn,600);
> } else {
> clearInterval(stopCount);
> stopRec=setInterval(recSomeNotes,5);
> }
> }

This looks very odd. It's possible that you create multiple interval
timers (before you find that REALTIME >= 0), but you only store the ID of
the last one, so all but that one can't be cancelled.

It appears that you want to keep checking some time to take action later
in the else clause. Can't you calculate when REALTIME will become >= 0?
Then you could use setTimeout.

Please learn to use local variables.

--
Ben.

Re: Serialise setInterval

<218df00c-5084-47ae-a2f6-9cb9f8452a83n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16938&group=comp.lang.javascript#16938

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ae9:df46:: with SMTP id t67mr4612707qkf.269.1621513222622;
Thu, 20 May 2021 05:20:22 -0700 (PDT)
X-Received: by 2002:a05:6830:1695:: with SMTP id k21mr3557380otr.2.1621513222349;
Thu, 20 May 2021 05:20:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:20:22 -0700 (PDT)
In-Reply-To: <87bl96w4f0.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <218df00c-5084-47ae-a2f6-9cb9f8452a83n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:20:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:20 UTC

torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> >> Can someone give a minimalistic example on howto serialise two setIntervals?
> >> "To some sort of accuracy"
> > Can someone tell why this approach would not work?
> > function countIn(){
> > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > if (REALTIME<0){
> > stopCount=setInterval(countIn,600);
> > } else {
> > clearInterval(stopCount);
> > stopRec=setInterval(recSomeNotes,5);
> > }
> > }
> This looks very odd. It's possible that you create multiple interval
> timers (before you find that REALTIME >= 0), but you only store the ID of
> the last one, so all but that one can't be cancelled.
>
> It appears that you want to keep checking some time to take action later
> in the else clause. Can't you calculate when REALTIME will become >= 0?
> Then you could use setTimeout.
>
> Please learn to use local variables.
>
> --
> Ben.
Well that would become 4 timeouts so howto serialise them. The problem with use same setInterval for all is that i have other animation process that also should start at 0 likewise the recording.
I really do not understand how it can be so complex to write two interval function after eachother, it must been anticipated?

Re: Serialise setInterval

<fc84edc8-fb67-475d-86e2-4b999cfee332n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16939&group=comp.lang.javascript#16939

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:734e:: with SMTP id q14mr4751233qtp.133.1621513344506;
Thu, 20 May 2021 05:22:24 -0700 (PDT)
X-Received: by 2002:a05:6808:4c2:: with SMTP id a2mr3077032oie.150.1621513344217;
Thu, 20 May 2021 05:22:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:22:23 -0700 (PDT)
In-Reply-To: <87bl96w4f0.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc84edc8-fb67-475d-86e2-4b999cfee332n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:22:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:22 UTC

torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> >> Can someone give a minimalistic example on howto serialise two setIntervals?
> >> "To some sort of accuracy"
> > Can someone tell why this approach would not work?
> > function countIn(){
> > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > if (REALTIME<0){
> > stopCount=setInterval(countIn,600);
> > } else {
> > clearInterval(stopCount);
> > stopRec=setInterval(recSomeNotes,5);
> > }
> > }
> This looks very odd. It's possible that you create multiple interval
> timers (before you find that REALTIME >= 0), but you only store the ID of
> the last one, so all but that one can't be cancelled.
>
> It appears that you want to keep checking some time to take action later
> in the else clause. Can't you calculate when REALTIME will become >= 0?
> Then you could use setTimeout.
>
> Please learn to use local variables.
>
> --
> Ben.
Yeah you are correct Ben there seem to be multiple instances created i should break out the call.

Re: Serialise setInterval

<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16940&group=comp.lang.javascript#16940

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:5d8f:: with SMTP id d15mr4918216qtx.350.1621513536833;
Thu, 20 May 2021 05:25:36 -0700 (PDT)
X-Received: by 2002:a4a:a3c3:: with SMTP id t3mr3533810ool.50.1621513536573;
Thu, 20 May 2021 05:25:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:25:36 -0700 (PDT)
In-Reply-To: <87bl96w4f0.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:25:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:25 UTC

torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> >> Can someone give a minimalistic example on howto serialise two setIntervals?
> >> "To some sort of accuracy"
> > Can someone tell why this approach would not work?
> > function countIn(){
> > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > if (REALTIME<0){
> > stopCount=setInterval(countIn,600);
> > } else {
> > clearInterval(stopCount);
> > stopRec=setInterval(recSomeNotes,5);
> > }
> > }
> This looks very odd. It's possible that you create multiple interval
> timers (before you find that REALTIME >= 0), but you only store the ID of
> the last one, so all but that one can't be cancelled.
>
> It appears that you want to keep checking some time to take action later
> in the else clause. Can't you calculate when REALTIME will become >= 0?
> Then you could use setTimeout.
>
> Please learn to use local variables.
>
> --
> Ben.
I did come up with something like this but it is not working, can anyone see why?

function countIn(){
REALTIME=(performance.now()-browserLoadTIME)-2400;
if (REALTIME<0){
if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
noteMessage = [153, 77, metvol];
outportarr[outportindex].send(noteMessage);
//DRAWOUT COUNTIN SQUARES
ctT.fillStyle = "red";
ctT.fillRect(240+prog, 5, 10,10);
prog=prog+15;
jint++;
mvol++;
stopCount=setInterval(countIn,600);
} else {
if (rendScroll){
clearInterval(stopCount);
browserLoadTIME=performance.now();
startScrollAnime();
stopRec=setInterval(recSomeNotes,5);
}
}
}

Re: Serialise setInterval

<53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16941&group=comp.lang.javascript#16941

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:1085:: with SMTP id a5mr4859202qtj.178.1621513730961;
Thu, 20 May 2021 05:28:50 -0700 (PDT)
X-Received: by 2002:aca:4244:: with SMTP id p65mr1495544oia.8.1621513730678;
Thu, 20 May 2021 05:28:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:28:50 -0700 (PDT)
In-Reply-To: <513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:28:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:28 UTC

torsdag 20 maj 2021 kl. 14:25:41 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> > Jonas Thörnvall <jonas.t...@gmail.com> writes:
> >
> > > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> > >> Can someone give a minimalistic example on howto serialise two setIntervals?
> > >> "To some sort of accuracy"
> > > Can someone tell why this approach would not work?
> > > function countIn(){
> > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > if (REALTIME<0){
> > > stopCount=setInterval(countIn,600);
> > > } else {
> > > clearInterval(stopCount);
> > > stopRec=setInterval(recSomeNotes,5);
> > > }
> > > }
> > This looks very odd. It's possible that you create multiple interval
> > timers (before you find that REALTIME >= 0), but you only store the ID of
> > the last one, so all but that one can't be cancelled.
> >
> > It appears that you want to keep checking some time to take action later
> > in the else clause. Can't you calculate when REALTIME will become >= 0?
> > Then you could use setTimeout.
> >
> > Please learn to use local variables.
> >
> > --
> > Ben.
> I did come up with something like this but it is not working, can anyone see why?
> function countIn(){
> REALTIME=(performance.now()-browserLoadTIME)-2400;
> if (REALTIME<0){
> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> noteMessage = [153, 77, metvol];
> outportarr[outportindex].send(noteMessage);
> //DRAWOUT COUNTIN SQUARES
> ctT.fillStyle = "red";
> ctT.fillRect(240+prog, 5, 10,10);
> prog=prog+15;
> jint++;
> mvol++;
> stopCount=setInterval(countIn,600);
> } else {
> if (rendScroll){
> clearInterval(stopCount);
> browserLoadTIME=performance.now();
> startScrollAnime();
> stopRec=setInterval(recSomeNotes,5);
> }
> }
> }
Oops missed this call line outside function.
stopCount=setInterval(countIn,600);

Re: Serialise setInterval

<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16943&group=comp.lang.javascript#16943

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a05:620a:127b:: with SMTP id b27mr4792875qkl.104.1621514187227;
Thu, 20 May 2021 05:36:27 -0700 (PDT)
X-Received: by 2002:a9d:2de3:: with SMTP id g90mr3735422otb.274.1621514186837;
Thu, 20 May 2021 05:36:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder5.feed.usenet.farm!feeder1.feed.usenet.farm!feed.usenet.farm!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:36:26 -0700 (PDT)
In-Reply-To: <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:36:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:36 UTC

torsdag 20 maj 2021 kl. 14:28:54 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 14:25:41 UTC+2 skrev Jonas Thörnvall:
> > torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> > > Jonas Thörnvall <jonas.t...@gmail.com> writes:
> > >
> > > > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> > > >> Can someone give a minimalistic example on howto serialise two setIntervals?
> > > >> "To some sort of accuracy"
> > > > Can someone tell why this approach would not work?
> > > > function countIn(){
> > > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > > if (REALTIME<0){
> > > > stopCount=setInterval(countIn,600);
> > > > } else {
> > > > clearInterval(stopCount);
> > > > stopRec=setInterval(recSomeNotes,5);
> > > > }
> > > > }
> > > This looks very odd. It's possible that you create multiple interval
> > > timers (before you find that REALTIME >= 0), but you only store the ID of
> > > the last one, so all but that one can't be cancelled.
> > >
> > > It appears that you want to keep checking some time to take action later
> > > in the else clause. Can't you calculate when REALTIME will become >= 0?
> > > Then you could use setTimeout.
> > >
> > > Please learn to use local variables.
> > >
> > > --
> > > Ben.
> > I did come up with something like this but it is not working, can anyone see why?
> > function countIn(){
> > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > if (REALTIME<0){
> > if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> > noteMessage = [153, 77, metvol];
> > outportarr[outportindex].send(noteMessage);
> > //DRAWOUT COUNTIN SQUARES
> > ctT.fillStyle = "red";
> > ctT.fillRect(240+prog, 5, 10,10);
> > prog=prog+15;
> > jint++;
> > mvol++;
> > stopCount=setInterval(countIn,600);
> > } else {
> > if (rendScroll){
> > clearInterval(stopCount);
> > browserLoadTIME=performance.now();
> > startScrollAnime();
> > stopRec=setInterval(recSomeNotes,5);
> > }
> > }
> > }
> Oops missed this call line outside function.
> stopCount=setInterval(countIn,600);

stopCount=setInterval(countIn,600);

function countIn(){
REALTIME=(performance.now()-browserLoadTIME)-2400;
if (REALTIME<0){
if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
noteMessage = [153, 77, metvol];
outportarr[outportindex].send(noteMessage);
//DRAWOUT COUNTIN SQUARES
ctT.fillStyle = "red";
ctT.fillRect(240+prog, 5, 10,10);
prog=prog+15;
jint++;
mvol++;
stopCount=setInterval(countIn,600);
} else {
if (rendScroll){
startScrollAnime();
}
clearInterval(stopCount);
stopRec=setInterval(recSomeNotes,5);
browserLoadTIME=performance.now();

}
}

Re: Serialise setInterval

<a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16944&group=comp.lang.javascript#16944

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a05:620a:2226:: with SMTP id n6mr5022084qkh.496.1621514580778;
Thu, 20 May 2021 05:43:00 -0700 (PDT)
X-Received: by 2002:aca:bc02:: with SMTP id m2mr3015742oif.154.1621514580535;
Thu, 20 May 2021 05:43:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:43:00 -0700 (PDT)
In-Reply-To: <720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:43:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:43 UTC

torsdag 20 maj 2021 kl. 14:36:31 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 14:28:54 UTC+2 skrev Jonas Thörnvall:
> > torsdag 20 maj 2021 kl. 14:25:41 UTC+2 skrev Jonas Thörnvall:
> > > torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> > > > Jonas Thörnvall <jonas.t...@gmail.com> writes:
> > > >
> > > > > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> > > > >> Can someone give a minimalistic example on howto serialise two setIntervals?
> > > > >> "To some sort of accuracy"
> > > > > Can someone tell why this approach would not work?
> > > > > function countIn(){
> > > > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > > > if (REALTIME<0){
> > > > > stopCount=setInterval(countIn,600);
> > > > > } else {
> > > > > clearInterval(stopCount);
> > > > > stopRec=setInterval(recSomeNotes,5);
> > > > > }
> > > > > }
> > > > This looks very odd. It's possible that you create multiple interval
> > > > timers (before you find that REALTIME >= 0), but you only store the ID of
> > > > the last one, so all but that one can't be cancelled.
> > > >
> > > > It appears that you want to keep checking some time to take action later
> > > > in the else clause. Can't you calculate when REALTIME will become >= 0?
> > > > Then you could use setTimeout.
> > > >
> > > > Please learn to use local variables.
> > > >
> > > > --
> > > > Ben.
> > > I did come up with something like this but it is not working, can anyone see why?
> > > function countIn(){
> > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > if (REALTIME<0){
> > > if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> > > noteMessage = [153, 77, metvol];
> > > outportarr[outportindex].send(noteMessage);
> > > //DRAWOUT COUNTIN SQUARES
> > > ctT.fillStyle = "red";
> > > ctT.fillRect(240+prog, 5, 10,10);
> > > prog=prog+15;
> > > jint++;
> > > mvol++;
> > > stopCount=setInterval(countIn,600);
> > > } else {
> > > if (rendScroll){
> > > clearInterval(stopCount);
> > > browserLoadTIME=performance.now();
> > > startScrollAnime();
> > > stopRec=setInterval(recSomeNotes,5);
> > > }
> > > }
> > > }
> > Oops missed this call line outside function.
> > stopCount=setInterval(countIn,600);
> stopCount=setInterval(countIn,600);
> function countIn(){
> REALTIME=(performance.now()-browserLoadTIME)-2400;
> if (REALTIME<0){
> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> noteMessage = [153, 77, metvol];
> outportarr[outportindex].send(noteMessage);
> //DRAWOUT COUNTIN SQUARES
> ctT.fillStyle = "red";
> ctT.fillRect(240+prog, 5, 10,10);
> prog=prog+15;
> jint++;
> mvol++;
> stopCount=setInterval(countIn,600);
> } else {
> if (rendScroll){
> startScrollAnime();
> }
> clearInterval(stopCount);
> stopRec=setInterval(recSomeNotes,5);
> browserLoadTIME=performance.now();
>
> }
> }
A simple example please on howto first run setInterval A and then setInterval B please..... this drives me nuts.

Re: Serialise setInterval

<f34bee37-def3-4986-a0c2-62a59bc394fdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16945&group=comp.lang.javascript#16945

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a05:6214:18d:: with SMTP id q13mr5298803qvr.60.1621515308696;
Thu, 20 May 2021 05:55:08 -0700 (PDT)
X-Received: by 2002:a9d:7610:: with SMTP id k16mr1485497otl.32.1621515308355;
Thu, 20 May 2021 05:55:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 05:55:08 -0700 (PDT)
In-Reply-To: <720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f34bee37-def3-4986-a0c2-62a59bc394fdn@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 12:55:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 12:55 UTC

torsdag 20 maj 2021 kl. 14:36:31 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 14:28:54 UTC+2 skrev Jonas Thörnvall:
> > torsdag 20 maj 2021 kl. 14:25:41 UTC+2 skrev Jonas Thörnvall:
> > > torsdag 20 maj 2021 kl. 04:00:11 UTC+2 skrev Ben Bacarisse:
> > > > Jonas Thörnvall <jonas.t...@gmail.com> writes:
> > > >
> > > > > onsdag 19 maj 2021 kl. 22:05:19 UTC+2 skrev Jonas Thörnvall:
> > > > >> Can someone give a minimalistic example on howto serialise two setIntervals?
> > > > >> "To some sort of accuracy"
> > > > > Can someone tell why this approach would not work?
> > > > > function countIn(){
> > > > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > > > if (REALTIME<0){
> > > > > stopCount=setInterval(countIn,600);
> > > > > } else {
> > > > > clearInterval(stopCount);
> > > > > stopRec=setInterval(recSomeNotes,5);
> > > > > }
> > > > > }
> > > > This looks very odd. It's possible that you create multiple interval
> > > > timers (before you find that REALTIME >= 0), but you only store the ID of
> > > > the last one, so all but that one can't be cancelled.
> > > >
> > > > It appears that you want to keep checking some time to take action later
> > > > in the else clause. Can't you calculate when REALTIME will become >= 0?
> > > > Then you could use setTimeout.
> > > >
> > > > Please learn to use local variables.
> > > >
> > > > --
> > > > Ben.
> > > I did come up with something like this but it is not working, can anyone see why?
> > > function countIn(){
> > > REALTIME=(performance.now()-browserLoadTIME)-2400;
> > > if (REALTIME<0){
> > > if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> > > noteMessage = [153, 77, metvol];
> > > outportarr[outportindex].send(noteMessage);
> > > //DRAWOUT COUNTIN SQUARES
> > > ctT.fillStyle = "red";
> > > ctT.fillRect(240+prog, 5, 10,10);
> > > prog=prog+15;
> > > jint++;
> > > mvol++;
> > > stopCount=setInterval(countIn,600);
> > > } else {
> > > if (rendScroll){
> > > clearInterval(stopCount);
> > > browserLoadTIME=performance.now();
> > > startScrollAnime();
> > > stopRec=setInterval(recSomeNotes,5);
> > > }
> > > }
> > > }
> > Oops missed this call line outside function.
> > stopCount=setInterval(countIn,600);
> stopCount=setInterval(countIn,600);
> function countIn(){
> REALTIME=(performance.now()-browserLoadTIME)-2400;
> if (REALTIME<0){
> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> noteMessage = [153, 77, metvol];
> outportarr[outportindex].send(noteMessage);
> //DRAWOUT COUNTIN SQUARES
> ctT.fillStyle = "red";
> ctT.fillRect(240+prog, 5, 10,10);
> prog=prog+15;
> jint++;
> mvol++;
> stopCount=setInterval(countIn,600);
> } else {
> if (rendScroll){
> startScrollAnime();
> }
> clearInterval(stopCount);
> stopRec=setInterval(recSomeNotes,5);
> browserLoadTIME=performance.now();
>
> }
> }
This one is real close but the playup never starts, it is strange it is the same call that work without the countIn.
function countIn(){
if (jint<8){
if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
noteMessage = [153, 77, metvol];
outportarr[outportindex].send(noteMessage);
//DRAWOUT COUNTIN SQUARES
ctT.fillStyle = "red";
ctT.fillRect(240+prog, 5, 10,10);
prog=prog+15;
jint++;
mvol++;
} else {
if (rendScroll){
clearInterval(stopCount);
startScrollAnime();
browserLoadTIME=performance.now();
stopRec=setInterval(recSomeNotes,5);
}
}
}

function recSomeNotes(){
REALTIME=performance.now()-browserLoadTIME;
while(REALTIME>schedTime){
outportarr[outportindex].send(noteMessage[playPos]);
if (echo && mode=="Play"){
pianoKeypressOut();
}
schedTime=copyEv[playPos]+schedTime;
playPos++;
}
if (playPos>copyEv.length) {stop();}
}

Re: Serialise setInterval

<87a6optqde.fsf@bsb.me.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16946&group=comp.lang.javascript#16946

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.javascript
Subject: Re: Serialise setInterval
Date: Thu, 20 May 2021 15:46:21 +0100
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <87a6optqde.fsf@bsb.me.uk>
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com>
<87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>
<53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
<a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="40361b37221cb96cb28693c773a02343";
logging-data="17025"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mlz65xFFIdJZSNfX7i2tXdUUSHhT0W30="
Cancel-Lock: sha1:o51kJGijzAQ0Zeaqow/QjWJi8Pk=
sha1:twfcIxD3TUhmfdmPIWDRIXgdYmw=
X-BSB-Auth: 1.cf0c8ecdf72ca08e9bdf.20210520154621BST.87a6optqde.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 20 May 2021 14:46 UTC

Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> torsdag 20 maj 2021 kl. 14:36:31 UTC+2 skrev Jonas Thörnvall:

>> stopCount=setInterval(countIn,600);
>> function countIn(){
>> REALTIME=(performance.now()-browserLoadTIME)-2400;
>> if (REALTIME<0){
>> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
>> noteMessage = [153, 77, metvol];
>> outportarr[outportindex].send(noteMessage);
>> //DRAWOUT COUNTIN SQUARES
>> ctT.fillStyle = "red";
>> ctT.fillRect(240+prog, 5, 10,10);
>> prog=prog+15;
>> jint++;
>> mvol++;
>> stopCount=setInterval(countIn,600);
>> } else {
>> if (rendScroll){
>> startScrollAnime();
>> }
>> clearInterval(stopCount);
>> stopRec=setInterval(recSomeNotes,5);
>> browserLoadTIME=performance.now();
>>
>> }
>> }

I am not going to try to read that. Programmers don't write code like
that for a reason. We've learned not to (by "we" I mean the community
of programmers).

> A simple example please on howto first run setInterval A and then
> setInterval B please..... this drives me nuts.

You can not mean what you say. And if you mean create an interval timer
that fires only once, and then, create a second (which might repeat) then
why are you not using setTimeout for the first?

But to guess a bit at what you want, here is code that waits for two
seconds and then prints "go", after which "tick" is printed five times,
half a second apart.

console.log("Wait for it...");

const longTimer = setInterval(
() => {
clearInterval(longTimer);
console.log("go");
var nTicks = 0;
const shortTimer = setInterval(
() => {
if (nTicks++ >= 5)
clearInterval(shortTimer);
else console.log("tick");
}, 500);
}, 2000);

--
Ben.

Re: Serialise setInterval

<89332481-108f-48d2-8487-fc059757b6een@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16947&group=comp.lang.javascript#16947

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a0c:9e0f:: with SMTP id p15mr6290686qve.33.1621523598433;
Thu, 20 May 2021 08:13:18 -0700 (PDT)
X-Received: by 2002:a54:4e10:: with SMTP id a16mr3891359oiy.48.1621523598035;
Thu, 20 May 2021 08:13:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 08:13:17 -0700 (PDT)
In-Reply-To: <87a6optqde.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <89332481-108f-48d2-8487-fc059757b6een@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 15:13:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 15:13 UTC

torsdag 20 maj 2021 kl. 16:46:29 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > torsdag 20 maj 2021 kl. 14:36:31 UTC+2 skrev Jonas Thörnvall:
>
> >> stopCount=setInterval(countIn,600);
> >> function countIn(){
> >> REALTIME=(performance.now()-browserLoadTIME)-2400;
> >> if (REALTIME<0){
> >> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> >> noteMessage = [153, 77, metvol];
> >> outportarr[outportindex].send(noteMessage);
> >> //DRAWOUT COUNTIN SQUARES
> >> ctT.fillStyle = "red";
> >> ctT.fillRect(240+prog, 5, 10,10);
> >> prog=prog+15;
> >> jint++;
> >> mvol++;
> >> stopCount=setInterval(countIn,600);
> >> } else {
> >> if (rendScroll){
> >> startScrollAnime();
> >> }
> >> clearInterval(stopCount);
> >> stopRec=setInterval(recSomeNotes,5);
> >> browserLoadTIME=performance.now();
> >>
> >> }
> >> }
> I am not going to try to read that. Programmers don't write code like
> that for a reason. We've learned not to (by "we" I mean the community
> of programmers).
> > A simple example please on howto first run setInterval A and then
> > setInterval B please..... this drives me nuts.
> You can not mean what you say. And if you mean create an interval timer
> that fires only once, and then, create a second (which might repeat) then
> why are you not using setTimeout for the first?
>
> But to guess a bit at what you want, here is code that waits for two
> seconds and then prints "go", after which "tick" is printed five times,
> half a second apart.
>
> console.log("Wait for it...");
>
> const longTimer = setInterval(
> () => {
> clearInterval(longTimer);
> console.log("go");
> var nTicks = 0;
> const shortTimer = setInterval(
> () => {
> if (nTicks++ >= 5)
> clearInterval(shortTimer);
> else console.log("tick");
> }, 500);
> }, 2000);
>
> --
> Ben.
Yeah thank you Ben, but where did good ol meta code go. Why does javascript code look so contrieved, two sequentail things nested in eachother LoL, it would be hilarious if it was not deranged.
And things like const longTimer = setInterval( () => { how do one even come up with such concepts and what is it supposed to mean?
Is it setInterval with some sort of inlined function between clause?

And again why is the two intervals calls nested in eachother, is it basicly the same as i do splitting the second call thru the else but you do the second thing inside the first LoL
Can someone honestly say that doing two consecutive processes in this way is not contrieved?

And thanks again Ben, i think i understand the code does not really mean i do.
Do you think we can get a switch on setInterval and setTimeout to run them single threaded......
It would advance the readability of the code with some quadratic factor LoL

Re: Serialise setInterval

<87zgwps8pw.fsf@bsb.me.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16948&group=comp.lang.javascript#16948

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.javascript
Subject: Re: Serialise setInterval
Date: Thu, 20 May 2021 16:52:59 +0100
Organization: A noiseless patient Spider
Lines: 90
Message-ID: <87zgwps8pw.fsf@bsb.me.uk>
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com>
<87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com>
<53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com>
<a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk>
<89332481-108f-48d2-8487-fc059757b6een@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="40361b37221cb96cb28693c773a02343";
logging-data="25352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Lkkq3Tr3u+ImbQPmFhFmbwu4BsXVzfyI="
Cancel-Lock: sha1:ZuR8lAq2q6slfc2gp0gkyX8QUQI=
sha1:bylEOp2Fg8qoLuEPKj30Vg6NK1Q=
X-BSB-Auth: 1.d45d4e0b8857f79c03bb.20210520165259BST.87zgwps8pw.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 20 May 2021 15:52 UTC

Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> torsdag 20 maj 2021 kl. 16:46:29 UTC+2 skrev Ben Bacarisse:
>> console.log("Wait for it...");
>>
>> const longTimer = setInterval(
>> () => {
>> clearInterval(longTimer);
>> console.log("go");
>> var nTicks = 0;
>> const shortTimer = setInterval(
>> () => {
>> if (nTicks++ >= 5)
>> clearInterval(shortTimer);
>> else console.log("tick");
>> }, 500);
>> }, 2000);

My code was indented. Maybe Google broke that as well...

> Yeah thank you Ben, but where did good ol meta code go. Why does
> javascript code look so contrieved, two sequentail things nested in
> eachother LoL, it would be hilarious if it was not deranged.

It's not deranged. It's designed like that for very good reason, but
I'm not going to get into that.

> And things like const longTimer = setInterval( () => { how do one
> even come up with such concepts and what is it supposed to mean?

Which bit? I want a local variable for the returned timer ID. I'm never
going to change it so I'll let everyone know that by declaring it const.

The two things that look like this:

() => { ... code ... }

and simply anonymous functions. They are very similar to functions
sometimes seen in older code created like this

function () { ... code ... }

They are often used for call-backs because you don't usually need to
create a named function when it's going to used in just one place.

> Is it setInterval with some sort of inlined function between clause?

Err... maybe, but inlined doesn't mean what you think it means.

> And again why is the two intervals calls nested in eachother, is it
> basicly the same as i do splitting the second call thru the else but
> you do the second thing inside the first

I don't know what you mean. Here is the same program written with named
functions. Note that I've still decided to limit the scope of the name
of the shortCallback function so it can have exclusive access to the
counter:

console.log("Wait for it...");
const longTimer = setInterval(longCallback, 2000);

function longCallback() {
clearInterval(longTimer);
console.log("go");
var nTicks = 0;
const shortTimer = setInterval(shortCallback, 500);

function shortCallback() {
if (nTicks++ >= 5)
clearInterval(shortTimer);
else console.log("tick");
}
}

> Can someone honestly say that doing two consecutive processes in this
> way is not contrieved?

Yes, there are very good reasons for it.

Unfortunately I'm not convinced that these setTimeout calls are the
right way to do whatever it is you are trying to do.

> And thanks again Ben, i think i understand the code does not really mean i do.
> Do you think we can get a switch on setInterval and setTimeout to run
> them single threaded......

They already run single-threaded.

--
Ben.

Re: Serialise setInterval

<bd697cc9-8ebd-455e-b38f-c6c0362a503fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16949&group=comp.lang.javascript#16949

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a37:9e4c:: with SMTP id h73mr5955794qke.68.1621527092445;
Thu, 20 May 2021 09:11:32 -0700 (PDT)
X-Received: by 2002:a54:4113:: with SMTP id l19mr3813838oic.38.1621527092231;
Thu, 20 May 2021 09:11:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 09:11:31 -0700 (PDT)
In-Reply-To: <87zgwps8pw.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk> <89332481-108f-48d2-8487-fc059757b6een@googlegroups.com>
<87zgwps8pw.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bd697cc9-8ebd-455e-b38f-c6c0362a503fn@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 16:11:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 16:11 UTC

torsdag 20 maj 2021 kl. 17:53:09 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > torsdag 20 maj 2021 kl. 16:46:29 UTC+2 skrev Ben Bacarisse:
> >> console.log("Wait for it...");
> >>
> >> const longTimer = setInterval(
> >> () => {
> >> clearInterval(longTimer);
> >> console.log("go");
> >> var nTicks = 0;
> >> const shortTimer = setInterval(
> >> () => {
> >> if (nTicks++ >= 5)
> >> clearInterval(shortTimer);
> >> else console.log("tick");
> >> }, 500);
> >> }, 2000);
> My code was indented. Maybe Google broke that as well...
> > Yeah thank you Ben, but where did good ol meta code go. Why does
> > javascript code look so contrieved, two sequentail things nested in
> > eachother LoL, it would be hilarious if it was not deranged.
> It's not deranged. It's designed like that for very good reason, but
> I'm not going to get into that.
> > And things like const longTimer = setInterval( () => { how do one
> > even come up with such concepts and what is it supposed to mean?
> Which bit? I want a local variable for the returned timer ID. I'm never
> going to change it so I'll let everyone know that by declaring it const.
>
> The two things that look like this:
>
> () => { ... code ... }
>
> and simply anonymous functions. They are very similar to functions
> sometimes seen in older code created like this
>
> function () { ... code ... }
>
> They are often used for call-backs because you don't usually need to
> create a named function when it's going to used in just one place.
> > Is it setInterval with some sort of inlined function between clause?
> Err... maybe, but inlined doesn't mean what you think it means.
> > And again why is the two intervals calls nested in eachother, is it
> > basicly the same as i do splitting the second call thru the else but
> > you do the second thing inside the first
> I don't know what you mean. Here is the same program written with named
> functions. Note that I've still decided to limit the scope of the name
> of the shortCallback function so it can have exclusive access to the
> counter:
> console.log("Wait for it...");
> const longTimer = setInterval(longCallback, 2000);
>
> function longCallback() {
> clearInterval(longTimer);
> console.log("go");
> var nTicks = 0;
> const shortTimer = setInterval(shortCallback, 500);
>
> function shortCallback() {
> if (nTicks++ >= 5)
> clearInterval(shortTimer);
> else console.log("tick");
> }
> }
> > Can someone honestly say that doing two consecutive processes in this
> > way is not contrieved?
> Yes, there are very good reasons for it.
>
> Unfortunately I'm not convinced that these setTimeout calls are the
> right way to do whatever it is you are trying to do.
> > And thanks again Ben, i think i understand the code does not really mean i do.
> > Do you think we can get a switch on setInterval and setTimeout to run
> > them single threaded......
> They already run single-threaded.
>
> --
> Ben.
Yeah but they run concurrent if you place them in sequense.
setInterval(1)
setInterval(2)

Re: Serialise setInterval

<d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16950&group=comp.lang.javascript#16950

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a05:622a:148a:: with SMTP id t10mr5974480qtx.214.1621527457633;
Thu, 20 May 2021 09:17:37 -0700 (PDT)
X-Received: by 2002:aca:75c7:: with SMTP id q190mr2758977oic.80.1621527457313;
Thu, 20 May 2021 09:17:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 09:17:37 -0700 (PDT)
In-Reply-To: <87a6optqde.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 16:17:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 16:17 UTC

torsdag 20 maj 2021 kl. 16:46:29 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.t...@gmail.com> writes:
>
> > torsdag 20 maj 2021 kl. 14:36:31 UTC+2 skrev Jonas Thörnvall:
>
> >> stopCount=setInterval(countIn,600);
> >> function countIn(){
> >> REALTIME=(performance.now()-browserLoadTIME)-2400;
> >> if (REALTIME<0){
> >> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> >> noteMessage = [153, 77, metvol];
> >> outportarr[outportindex].send(noteMessage);
> >> //DRAWOUT COUNTIN SQUARES
> >> ctT.fillStyle = "red";
> >> ctT.fillRect(240+prog, 5, 10,10);
> >> prog=prog+15;
> >> jint++;
> >> mvol++;
> >> stopCount=setInterval(countIn,600);
> >> } else {
> >> if (rendScroll){
> >> startScrollAnime();
> >> }
> >> clearInterval(stopCount);
> >> stopRec=setInterval(recSomeNotes,5);
> >> browserLoadTIME=performance.now();
> >>
> >> }
> >> }
> I am not going to try to read that. Programmers don't write code like
> that for a reason. We've learned not to (by "we" I mean the community
> of programmers).
> > A simple example please on howto first run setInterval A and then
> > setInterval B please..... this drives me nuts.
> You can not mean what you say. And if you mean create an interval timer
> that fires only once, and then, create a second (which might repeat) then
> why are you not using setTimeout for the first?
>
> But to guess a bit at what you want, here is code that waits for two
> seconds and then prints "go", after which "tick" is printed five times,
> half a second apart.
>
> console.log("Wait for it...");
>
> const longTimer = setInterval(
> () => {
> clearInterval(longTimer);
> console.log("go");
> var nTicks = 0;
> const shortTimer = setInterval(
> () => {
> if (nTicks++ >= 5)
> clearInterval(shortTimer);
> else console.log("tick");
> }, 500);
> }, 2000);
>
> --
> Ben.
A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions?
If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser.

Re: Serialise setInterval

<ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16952&group=comp.lang.javascript#16952

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: niam@jghnorth.org.uk.invalid (John G Harris)
Newsgroups: comp.lang.javascript
Subject: Re: Serialise setInterval
Date: Thu, 20 May 2021 18:40:43 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com>
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com> <80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk> <513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com> <720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com> <87a6optqde.fsf@bsb.me.uk> <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>
Reply-To: jgharris@ic4life.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="de2c59c38aa75358720173bc1d7e0f65";
logging-data="9345"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+shTtkz4Q3ZNv0O6RPYZtI+0yTCXiMg/4="
User-Agent: ForteAgent/7.00.32.1200
Cancel-Lock: sha1:DLidAXLKmMqKFjba+QY/ujDura8=
 by: John G Harris - Thu, 20 May 2021 17:40 UTC

On Thu, 20 May 2021 09:17:37 -0700 (PDT), Jonas Thörnvall
<jonas.thornvall@gmail.com> wrote:

<snip>
>A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions?
>If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser.

What you need is C++, C#, or Java. (Same name, different number of
parameters, makes it a different function.) Perhaps you should review
your choice of implementation language.

John

Re: Serialise setInterval

<12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16953&group=comp.lang.javascript#16953

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:7285:: with SMTP id v5mr7928629qto.247.1621549881161;
Thu, 20 May 2021 15:31:21 -0700 (PDT)
X-Received: by 2002:a05:6830:1e3b:: with SMTP id t27mr5702615otr.243.1621549880859;
Thu, 20 May 2021 15:31:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Thu, 20 May 2021 15:31:20 -0700 (PDT)
In-Reply-To: <ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk> <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>
<ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Thu, 20 May 2021 22:31:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Thu, 20 May 2021 22:31 UTC

torsdag 20 maj 2021 kl. 19:40:51 UTC+2 skrev John G Harris:
> On Thu, 20 May 2021 09:17:37 -0700 (PDT), Jonas Thörnvall
> <jonas.t...@gmail.com> wrote:
>
> <snip>
> >A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions?
> >If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser.
> What you need is C++, C#, or Java. (Same name, different number of
> parameters, makes it a different function.) Perhaps you should review
> your choice of implementation language.
>
> John
No i love the idea of running programs interpreted by the browser, and that is the success story of Javascript, availability.

Re: Serialise setInterval

<640cfe0f-0434-4340-9e2b-d2fa4adea581n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16960&group=comp.lang.javascript#16960

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:734e:: with SMTP id q14mr13775152qtp.133.1621635142188;
Fri, 21 May 2021 15:12:22 -0700 (PDT)
X-Received: by 2002:aca:3446:: with SMTP id b67mr3722430oia.136.1621635141888;
Fri, 21 May 2021 15:12:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Fri, 21 May 2021 15:12:21 -0700 (PDT)
In-Reply-To: <12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk> <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>
<ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com> <12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <640cfe0f-0434-4340-9e2b-d2fa4adea581n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Fri, 21 May 2021 22:12:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Fri, 21 May 2021 22:12 UTC

fredag 21 maj 2021 kl. 00:31:26 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 19:40:51 UTC+2 skrev John G Harris:
> > On Thu, 20 May 2021 09:17:37 -0700 (PDT), Jonas Thörnvall
> > <jonas.t...@gmail.com> wrote:
> >
> > <snip>
> > >A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions?
> > >If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser.
> > What you need is C++, C#, or Java. (Same name, different number of
> > parameters, makes it a different function.) Perhaps you should review
> > your choice of implementation language.
> >
> > John
> No i love the idea of running programs interpreted by the browser, and that is the success story of Javascript, availability.
Ok now i scrutinised my own code and i can not see why it should not work. I only call recSomeNotes one time after the countIn ended.

And if i skip countIn and go direct one recSomeNotes it work without problem.
First i call countIn 8 times?
The 9 time i stop the countIn
And startup recordSomeNotes "just a single time".

What is wrong i do not get it, it should work?
Because doing this directly work?
stopRec=setInterval(recSomeNotes,5);

So what goes wrong in this code?

stopCount=setInterval(countIn,600);

function countIn(){
if (jint<8){
if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
noteMessage = [153, 77, metvol];
outportarr[outportindex].send(noteMessage);
ctT.fillStyle = "red";
ctT.fillRect(240+prog, 5, 10,10);
prog=prog+15;
jint++;
mvol++;
} else {
if (rendScroll){
alert("fuck it");
clearInterval(stopCount);
startScrollAnime();
browserLoadTIME=performance.now();
stopRec=setInterval(recSomeNotes,5);
}
}
}

function recSomeNotes(){
REALTIME=performance.now()-browserLoadTIME;
while(REALTIME>schedTime){
outportarr[outportindex].send(noteMessage[playPos]);
if (echo && mode=="Play"){
pianoKeypressOut();
}
schedTime=copyEv[playPos]+schedTime;
playPos++;
}
if (playPos>copyEv.length) {stop();}
}

Re: Serialise setInterval

<bf0c18cd-2e41-4bee-bb24-7ffe7cb65ad3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16961&group=comp.lang.javascript#16961

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:5d8f:: with SMTP id d15mr14143427qtx.350.1621635260801;
Fri, 21 May 2021 15:14:20 -0700 (PDT)
X-Received: by 2002:a4a:2cc5:: with SMTP id o188mr9939450ooo.15.1621635260553;
Fri, 21 May 2021 15:14:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Fri, 21 May 2021 15:14:20 -0700 (PDT)
In-Reply-To: <640cfe0f-0434-4340-9e2b-d2fa4adea581n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=213.112.1.82; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW
NNTP-Posting-Host: 213.112.1.82
References: <6b1b8917-b6f8-42bd-bf1a-ac18d7c70624n@googlegroups.com>
<80fe2283-d42a-4205-bd90-5189e1ed5447n@googlegroups.com> <87bl96w4f0.fsf@bsb.me.uk>
<513d1eb1-651c-4624-aef7-8a2ca455ede3n@googlegroups.com> <53eab967-363f-494a-a9d2-cc08620b670en@googlegroups.com>
<720fbe37-8667-47e7-b73f-adc20f555836n@googlegroups.com> <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com>
<87a6optqde.fsf@bsb.me.uk> <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com>
<ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com> <12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>
<640cfe0f-0434-4340-9e2b-d2fa4adea581n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bf0c18cd-2e41-4bee-bb24-7ffe7cb65ad3n@googlegroups.com>
Subject: Re: Serialise setInterval
From: jonas.thornvall@gmail.com (Jonas Thörnvall)
Injection-Date: Fri, 21 May 2021 22:14:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jonas Thörnvall - Fri, 21 May 2021 22:14 UTC

lördag 22 maj 2021 kl. 00:12:26 UTC+2 skrev Jonas Thörnvall:
> fredag 21 maj 2021 kl. 00:31:26 UTC+2 skrev Jonas Thörnvall:
> > torsdag 20 maj 2021 kl. 19:40:51 UTC+2 skrev John G Harris:
> > > On Thu, 20 May 2021 09:17:37 -0700 (PDT), Jonas Thörnvall
> > > <jonas.t...@gmail.com> wrote:
> > >
> > > <snip>
> > > >A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions?
> > > >If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser.
> > > What you need is C++, C#, or Java. (Same name, different number of
> > > parameters, makes it a different function.) Perhaps you should review
> > > your choice of implementation language.
> > >
> > > John
> > No i love the idea of running programs interpreted by the browser, and that is the success story of Javascript, availability.
> Ok now i scrutinised my own code and i can not see why it should not work.. I only call recSomeNotes one time after the countIn ended.
>
> And if i skip countIn and go direct one recSomeNotes it work without problem.
> First i call countIn 8 times?
> The 9 time i stop the countIn
> And startup recordSomeNotes "just a single time".
>
> What is wrong i do not get it, it should work?
> Because doing this directly work?
> stopRec=setInterval(recSomeNotes,5);
>
>
> So what goes wrong in this code?
>
> stopCount=setInterval(countIn,600);
> function countIn(){
> if (jint<8){
> if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
> noteMessage = [153, 77, metvol];
> outportarr[outportindex].send(noteMessage);
> ctT.fillStyle = "red";
> ctT.fillRect(240+prog, 5, 10,10);
> prog=prog+15;
> jint++;
> mvol++;
> } else {
> if (rendScroll){
> alert("fuck it");
> clearInterval(stopCount);
> startScrollAnime();
> browserLoadTIME=performance.now();
> stopRec=setInterval(recSomeNotes,5);
> }
> }
> }
>
> function recSomeNotes(){
> REALTIME=performance.now()-browserLoadTIME;
> while(REALTIME>schedTime){
> outportarr[outportindex].send(noteMessage[playPos]);
> if (echo && mode=="Play"){
> pianoKeypressOut();
> }
> schedTime=copyEv[playPos]+schedTime;
> playPos++;
> }
> if (playPos>copyEv.length) {stop();}
> }
Oh i get an error message what does it mean?
TypeError: Failed to execute 'send' on 'MIDIOutput': Overload resolution failed.


devel / comp.lang.javascript / Re: Serialise setInterval

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor