• Re: Catching event from message alert box, and wait until resolved?

    From JJ@jj4public@vfemail.net to comp.lang.javascript on Wed Oct 10 05:39:30 2018
    From Newsgroup: comp.lang.javascript

    On Sun, 7 Oct 2018 22:58:12 -0700 (PDT), Jonas Thörnvall wrote:

    No i just want to wait for the user to handle the alert box, i want to
    wait for user input before loading the "main program that call listports" that use the midiaccess object that is not ready.

    Lets say this is my midiaccess file, how can i list ports after, the
    alert box been resolved. So how do i know when the alert box resolved,
    where do i call the listports(); or alternatively how do i wait until
    alert box resolved?

    The the arguments passed to the `then()` method is the result of the MIDI access request. It'll succeed if the user allow it, or it'll rejected if otherwise. By the time any is executed, the confirmation box has been
    responded by user. In your case, call `listPorts()` during or after
    `success()` is executed.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@jonas.thornvall@gmail.com to comp.lang.javascript on Tue Oct 9 21:50:13 2018
    From Newsgroup: comp.lang.javascript

    Den onsdag 10 oktober 2018 kl. 00:39:38 UTC+2 skrev JJ:
    On Sun, 7 Oct 2018 22:58:12 -0700 (PDT), Jonas Thörnvall wrote:

    No i just want to wait for the user to handle the alert box, i want to
    wait for user input before loading the "main program that call listports" that use the midiaccess object that is not ready.

    Lets say this is my midiaccess file, how can i list ports after, the
    alert box been resolved. So how do i know when the alert box resolved, where do i call the listports(); or alternatively how do i wait until
    alert box resolved?

    The the arguments passed to the `then()` method is the result of the MIDI access request. It'll succeed if the user allow it, or it'll rejected if otherwise. By the time any is executed, the confirmation box has been responded by user. In your case, call `listPorts()` during or after `success()` is executed.
    Well weither it is correct or not i tried to move the main(); call into the success method. It was not a good idea. Because for some reason then the alertbox "dialog" "allow block" is no longer ready, but open. Probably the script try to load resources after success that will not be available until i answered the alert box.
    It seem to be a catch 22 situation.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From JJ@jj4public@vfemail.net to comp.lang.javascript on Thu Oct 11 20:40:25 2018
    From Newsgroup: comp.lang.javascript

    On Tue, 9 Oct 2018 21:50:13 -0700 (PDT), Jonas Thörnvall wrote:

    Well weither it is correct or not i tried to move the main(); call into
    the success method. It was not a good idea. Because for some reason then
    the alertbox "dialog" "allow block" is no longer ready, but open.

    As long as MIDI access hasn't been granted, MIDI resources are not
    available.

    Probably the script try to load resources after success that will not be available until i answered the alert box.

    How come you don't know your own code?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@jonas.thornvall@gmail.com to comp.lang.javascript on Thu Oct 11 15:11:48 2018
    From Newsgroup: comp.lang.javascript

    Den torsdag 11 oktober 2018 kl. 15:40:33 UTC+2 skrev JJ:
    On Tue, 9 Oct 2018 21:50:13 -0700 (PDT), Jonas Thörnvall wrote:

    Well weither it is correct or not i tried to move the main(); call into the success method. It was not a good idea. Because for some reason then the alertbox "dialog" "allow block" is no longer ready, but open.

    As long as MIDI access hasn't been granted, MIDI resources are not
    available.

    Probably the script try to load resources after success that will not be available until i answered the alert box.

    How come you don't know your own code?
    I don't think that is the problem as long you have not pushed allow or block resources not available, and the error is not recoverable.
    But i am not as fast clicking as the computer throwing up the window. What i do want is wait call main until alert resolved. But i do not know how to know when alert resolved, how do i know and call main after "block or unblock".
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@jonas.thornvall@gmail.com to comp.lang.javascript on Sun Oct 14 20:56:57 2018
    From Newsgroup: comp.lang.javascript

    Den fredag 12 oktober 2018 kl. 00:11:57 UTC+2 skrev Jonas Thörnvall:
    Den torsdag 11 oktober 2018 kl. 15:40:33 UTC+2 skrev JJ:
    On Tue, 9 Oct 2018 21:50:13 -0700 (PDT), Jonas Thörnvall wrote:

    Well weither it is correct or not i tried to move the main(); call into the success method. It was not a good idea. Because for some reason then the alertbox "dialog" "allow block" is no longer ready, but open.

    As long as MIDI access hasn't been granted, MIDI resources are not available.

    Probably the script try to load resources after success that will not be available until i answered the alert box.

    How come you don't know your own code?

    I don't think that is the problem as long you have not pushed allow or block resources not available, and the error is not recoverable.

    But i am not as fast clicking as the computer throwing up the window. What i do want is wait call main until alert resolved. But i do not know how to know when alert resolved, how do i know and call main after "block or unblock".
    Well sysex on should probably somehow be invoked at later stage, because only needed when dump from what i understand. So then the question become can you change state of it? How, it is not available after midiaccess success?
    --- Synchronet 3.20a-Linux NewsLink 1.114