Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37227

Re: Howto rlelease the onmidimessage listener?

Newsgroups comp.lang.javascript
Date 2019-09-11 02:34 -0700
References <2ee6f8a1-220e-4618-899d-e82a30e2e3b4@googlegroups.com>
Message-ID <272b5ef2-e206-4e7f-a4d2-cf9fde245409@googlegroups.com> (permalink)
Subject Re: Howto rlelease the onmidimessage listener?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den onsdag 11 september 2019 kl. 08:39:21 UTC+2 skrev Jonas Thörnvall:
> This is the most common way people show howto implement inport listeners, they just scroll thru all.
> 
>  for (input = inputs.next(); input && !input.done; input = inputs.next()) {
>         input.value.onmidimessage = onMIDIMessage;
>   }
> 
> I have searched for howto release the listener but can not find information about it. Do anyone here know?
> 
> So instead i had the idea to reinitiate the whole requestMIDIAccess, that i thought would release the whole midiObject unfortunately is just created a new instance running on top.
> 
> So can anyone show me to information "preferably web example" on howto either.
> 
> release onMIDIMessage listener
> 
> OR
> 
> release requestMIDIAccess object/promise "whatever it is"

Can i ask why do not the webmidiAPI use add remove eventlistener?
Would it not been more logical with.

input.addEventListener("onMidiMessage");
input.removeEventListener("onMidiMessage");

and if inputs was an array instead of an iterator.
inputs[].addEventListener("onMidiMessage");
inputs[].removeEventListener("onMidiMessage");

Sometimes the solutions the guys who implement javascript just do not make sense  to me. I guess they have their reasons for implementing it the way they does, but it is totally beyond my understanding of the language.

How come i can search for hours but not come up with howto remove a listener for a port, isn't that fucking strange?

Either it is so cumberly hard to do that noone put the effort into do it. Or it is impossible. If someone put in the effort to do it, please post me the link.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-10 23:39 -0700
  Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-10 23:51 -0700
    Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-11 02:04 -0700
  Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-11 02:34 -0700
  Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-11 02:38 -0700
  Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-11 13:16 -0700
    Re: Howto rlelease the onmidimessage listener? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-09-12 00:10 -0700

csiph-web