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


Groups > comp.lang.prolog > #13228

Re: Request for comments, async ISO core standard I/O

From Mostowski Collapse <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Re: Request for comments, async ISO core standard I/O
Date 2022-09-16 02:54 +0200
Message-ID <tg0hgd$6n2t$1@solani.org> (permalink)
References (8 earlier) <30228514-d7f4-457f-9ed9-6b8b16617718n@googlegroups.com> <166fdad7-1a4e-42d1-8b99-6675db8b7442n@googlegroups.com> <b8cb57a7-2a98-48fd-ab7a-9d75ade2e009n@googlegroups.com> <8e2bd0c4-0976-48f1-917f-dda7c99bc840n@googlegroups.com> <8bc2353f-611a-4cee-a0ac-e63e43d4fcf5n@googlegroups.com>

Show all headers | View raw


On second though, I will not use this piece
of code, rather should work more consequently
in keeping the overal code async and the examples

async as well, so that it wont happen, that the browser
blocks. From GUI viewpoint its not so trivial
to make it async compatible. There are few tricks

needed. If there is only one action button this
works to avoid that multiple Prolog interpreter
calls are spawned:

     async function main_async() {
         document.getElementById("launch").disabled = true;
         try {
             async bla bla
         } finally {
             document.getElementById("launch").disabled = false;
         }
     }

     document.getElementById("launch")
         .addEventListener("click", main_async);

But if there are multiple action buttons,
more work is needed.

Mostowski Collapse schrieb:
> Why not load small JavaScript snippets synchronously
> in the browser? This one works for me. At least
> some local testing works already, its not yet deployed:
> 
> let parent = "";
> let cache = {};
> 
> /**
>   * Load a JavaScript text synchronously.
>   *
>   * @param url The url.
>   */
> function cludge(url) {
>      /* resolve and check */
>      if (parent !== "")
>          url = new URL(url, parent).href;
>      let map = cache[url];
>      if (map !== undefined)
>          return map;
>      map = {};
>      cache[url] = map;
> 
>      /* load and execute */
>      let back = parent;
>      try {
>          parent = url;
>          let request = new XMLHttpRequest();
>          request.open('GET', url, false);
>          request.send();
>          let fun = new Function("exports", "require", request.responseText);
>          fun(map, cludge);
>      } finally {
>          parent = back;
>      }
>      return map;
> }
> 
> Have Fun!
> 

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:28 -0700
  Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:29 -0700
    Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 01:20 -0700
      Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:41 -0700
        Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:52 -0700
          Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 06:23 -0700
            Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 08:27 -0700
              Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:49 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:54 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:56 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 01:48 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:37 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:38 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:39 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:47 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:59 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 08:12 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:41 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:42 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:22 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:25 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-21 00:57 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:30 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:31 -0700
              Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:08 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:10 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:38 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 12:18 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-04 14:19 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-15 14:09 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <janburse@fastmail.fm> - 2022-09-16 02:54 +0200
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:43 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:46 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:48 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:01 -0700
                Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:02 -0700
  Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:47 -0800
    Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:53 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:18 +0100
      Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:26 +0100
        Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-22 03:49 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-05 15:08 +0100
    Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:29 +0100
      Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:39 +0100
        Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:48 +0100
          Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:53 +0100
  Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:01 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:09 -0800
      Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:16 -0800
  Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:38 -0800
    Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:48 -0800
      Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:01 -0800
        Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:39 -0800

csiph-web