Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37176
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-09-02 10:30 -0700 |
| References | (1 earlier) <4c1ea5a9-c407-4752-920e-ec33b756af59@googlegroups.com> <ec9caa3f-68c8-4ac6-b805-e168f86cb0f0@googlegroups.com> <639nme9cjsjjkd8va38frenr8u6bbktr7u@4ax.com> <a9d2bf4a-5e03-425f-94d2-6be646c855e5@googlegroups.com> <5a71a523-ac87-4a4d-ae67-acd3396dd8e8@googlegroups.com> |
| Message-ID | <7ff31766-056d-4e02-97b1-e4614c3b16d9@googlegroups.com> (permalink) |
| Subject | Re: Object iterators |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den måndag 2 september 2019 kl. 19:16:38 UTC+2 skrev Jonas Thörnvall:
> Den söndag 1 september 2019 kl. 21:54:41 UTC+2 skrev Jonas Thörnvall:
> > Den söndag 1 september 2019 kl. 12:59:31 UTC+2 skrev John G Harris:
> > > On Sun, 1 Sep 2019 03:20:11 -0700 (PDT), Jonas Thörnvall
> > > <jonas.thornvall@gmail.com> wrote:
> > >
> > > <snip>
> > > >By the way what kind of syntax, is this?
> > > >input.value.onmidimessage = onMIDIMessage;
> > > >
> > > >omMIDIMessage is a function, to me it looks like an assigment i assign a function to input.value.onmidimessage?
> > > >
> > > >So is input.value.onmidimessage a listener or is it just onmidimessage that is the listener and input.value the object port?
> > > >
> > > >I mean the syntax is really not clear is it?
> > >
> > > The syntax is perfectly clear. After this statement the value of
> > > input.value.onmidimessage
> > > is now the same function object as the value of
> > > onMIDIMessage
> > >
> > > As a result, doing
> > > input.value.onmidimessage(x)
> > > is the same as doing
> > > onMIDIMessage(x)
> > >
> > > John
> >
> > Well John could you explain it in plain words not as syntax references?
> > function success(midi) {
> > mid = midi;
> > inputs = mid.inputs.values();
> > for (input = inputs.next(); input && !input.done; input = inputs.next()) {
> >
> > input.value.onmidimessage = onMIDIMessage;
> > }
> > }
> >
> > For me this interpretate to. A succesful midi object was created "They never explain what it actually is but i guess it is hold inputs and outputs "because these must exist "as reserved words or constants?" how else could i extract them from the midiobject with inputs = mid.inputs.values();. Apparently this assignment to inputs "create an iterator object?" whatever that is... Well i get the gist a stepthru object, can't imagine why anyone would prefer it over an array but beyond point....
> >
> > So i get the loop and its function, apparently it just steps thru the ports and assign them to input.
> >
> > However
> > input.value.onmidimessage = onMIDIMessage;
> > Is hieroglyphs to me?
> > What is "omnimidimessage" who created it "it is a reserved word, reserved object a constant" what is it?
> >
> > Input value i just interpretate like a port???
> > onMIDIMessage is a function that we somehow do what with?
> > I can see i assign it to input.value.onmidimessage?
> >
> > What is the thingy "code" that actually make the listener to the port?
> > And why is a function call an assignment.
> >
> > I can't follow the logic of the statements, i fucking know what is happening but the how and why is beyond me. That makes it very hard for me to make a listener for a single port. And how do you kill the listener on an input port?
>
> Well i guess when things implemented idiotic, they will by nature inherit idiotic solutions. I come up with one i just list the ports with checkboxes, the checked ones i will do "onmidimessage" on.
>
> But how to change the port listener state "on/off" after page loaded anyone?
>
> Basicly i ask if this is the code to turn of listener "at a port".
> input.value.onmidimessage = onMIDIMessage;
> What is the code to turn it off...
Solved it i just put the request of midi midiAccess into a function, and basicly relist the ports using the checkboxes...
But there probably is a way to kill each input onmidimessage listener instead of reinit the full midi.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-08-31 17:12 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-08-31 17:17 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-08-31 17:24 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 02:53 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 02:59 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 03:07 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 03:20 -0700
Re: Object iterators John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-01 11:59 +0100
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 05:54 -0700
Re: Object iterators John G Harris <niam@jghnorth.org.uk.invalid> - 2019-09-02 11:08 +0100
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-01 12:54 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-02 02:36 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-02 10:16 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-02 10:19 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-02 10:30 -0700
Re: Object iterators Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-03 23:26 -0700
Re: Object iterators 1975.nenad@googlemail.com - 2020-05-24 04:21 -0700
csiph-web