<div dir="ltr"><div><div>Hi Adam,</div><div><br></div><div>If I may, I'd like to advocate for a solution closer to the one that I have prototyped. I still believe the rpcCount source should be part of the standard library and that the rpc function should update the rpcCount source. Suppose, for example, that I am using a module that someone other than me developed and this module invokes the function rpc. If the rpc function updates the rpcCount source, my application would be able to show the busy indicator, which would not be true in this other solution.</div><div><br></div><div>In any case, this other solution made me think that maybe what we need in Ur/Web is something like the HTTP interceptors of AngularJS (look for interceptors in <a href="https://docs.angularjs.org/api/ng/service/$http">https://docs.angularjs.org/api/ng/service/$http</a>). In general terms, AngularJS allows one to register one or more listeners/observers that it calls whenever it is about to make a HTTP request and when it receives a HTTP response. This design is very general, allowing any kind of behavior related to HTTP requests to be plugged in, even in code developed by a third party. However, I am not sure if/how this fits in the pure world of Ur/Web.</div></div><div><br></div><div>Sincerely,</div><div>Saulo</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 26, 2016 at 1:48 PM, Adam Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    I'd rather see a version that doesn't use the JavaScript FFI,
    instead building, in Ur/Web code, a wrapper around [rpc].  I would
    include an abstract type of "RPC groups," with a constructor to
    create one in a transaction, plus an [rpc] variant and an
    is-there-an-active-RPC signal function that each take the group as
    input.<br>
    <br>
    Does that sound sufficiently pleasant to use?<span class=""><br>
    <br>
    <div>On 08/07/2016 11:28 PM, Saulo Araujo
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Sure! You can see it in action at <a href="http://timesheet-ur.sauloaraujo.com:8080/TimeSheet/application" target="_blank"></a><a href="http://timesheet-ur.sauloaraujo.com:8080/TimeSheet/application" target="_blank">http://timesheet-ur.<wbr>sauloaraujo.com:8080/<wbr>TimeSheet/application</a>.<br>
        </div>
        <div><br>
        </div>
        <div>The implementation is in the files <a href="https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.js" target="_blank"></a><a href="https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.js" target="_blank">https://github.com/<wbr>saulo2/timesheet-ur/blob/<wbr>master/timeSheet.js</a>
          and <a href="https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.ur" target="_blank">https://github.com/saulo2/<wbr>timesheet-ur/blob/master/<wbr>timeSheet.ur</a></div>
        <div><br>
        </div>
        <div>Sincreley,</div>
        <div>Saulo</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Aug 5, 2016 at 4:58 PM, Adam
          Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"><span> On
                07/22/2016 09:51 PM, Saulo Araujo wrote:<br>
                <blockquote type="cite">
                  <div dir="ltr">Thanks for your suggestion. It was
                    quite easy indeed. Do you think this signal
                    could/should be part of the Ur/Web standard library
                    and runtime? If so, I can make a pull request with
                    my implementation of this signal.</div>
                </blockquote>
                <br>
              </span> I'm not sure.  Can you point to an example of your
              construction in action?<br>
              <br>
              <blockquote type="cite">
                <div dir="ltr">
                  <div class="gmail_extra"><span>On Fri, Jul
                      22, 2016 at 9:13 PM, Adam Chlipala <span dir="ltr"><<a href="mailto:adamc@csail.mit.edu" target="_blank">adamc@csail.mit.edu</a>></span>
                      wrote:<br>
                    </span>
                    <div class="gmail_quote">
                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>I don't
                          have anything in particular in mind, but it
                          should be easy enough to get the appropriate
                          signals from Ur/Web.  It should even be
                          possible to write generic functionality to
                          wrap an RPC with code to change the status of
                          a busy indicator after the call returns.<br>
                        </span>
                        <div>
                          <div><span> <br>
                              On 07/22/2016 08:04 PM, Saulo Araujo
                              wrote:<br>
                            </span><span>
                              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I would
                                like to show a busy indicator when there
                                is an ongoing rpc. I was wondering if
                                there is a source that contains that
                                information. Does anyone know if is
                                there such source?<br>
                              </blockquote>
                            </span></div>
                        </div>
                      </blockquote>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </span></div>

<br>______________________________<wbr>_________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" rel="noreferrer" target="_blank">http://www.impredicative.com/<wbr>cgi-bin/mailman/listinfo/ur</a><br>
<br></blockquote></div><br></div>