Hi Adam, 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.
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 https://docs.angularjs.org/api/ng/service/$http). 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. Sincerely, Saulo On Fri, Aug 26, 2016 at 1:48 PM, Adam Chlipala <[email protected]> wrote: > 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. > > Does that sound sufficiently pleasant to use? > > On 08/07/2016 11:28 PM, Saulo Araujo wrote: > > Sure! You can see it in action at > <http://timesheet-ur.sauloaraujo.com:8080/TimeSheet/application> > http://timesheet-ur.sauloaraujo.com:8080/TimeSheet/application. > > The implementation is in the files > <https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.js> > https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.js and > https://github.com/saulo2/timesheet-ur/blob/master/timeSheet.ur > > Sincreley, > Saulo > > On Fri, Aug 5, 2016 at 4:58 PM, Adam Chlipala <[email protected]> wrote: > >> On 07/22/2016 09:51 PM, Saulo Araujo wrote: >> >> 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. >> >> >> I'm not sure. Can you point to an example of your construction in action? >> >> On Fri, Jul 22, 2016 at 9:13 PM, Adam Chlipala <[email protected]> >> wrote: >> >>> 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. >>> >>> On 07/22/2016 08:04 PM, Saulo Araujo wrote: >>> >>>> 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? >>>> >>> > _______________________________________________ > Ur mailing list > [email protected] > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > >
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
