Thanks. I'll take a look and see what fits.

~Philip

On Mon, Nov 28, 2011 at 1:59 AM, Barry van Oudtshoorn <
[email protected]> wrote:

>  Here you go:
>
> https://gist.github.com/1399519
>
> It's in dire need of tidying up (on my list of TODOs), but as it stands it
> works pretty well. It requires that responses be in JSON and be of the form
> { status: 'statusCode', (msg: ''), payload: <blah> }. It provides four main
> methods: _send_, for basic AJAX requests; _print_, a more specific version
> of _send_ that we use for producing and retrieving PDF documents; _upload_,
> for iframe-based AJAX-like uploading; and _cross_, for cross-domain JSONP.
>
> For _send_ and _print_, it will retry a few times, with an increasing (and
> randomised) back-off time. For all methods, it will only show the "Please
> wait" message (call a custom $wait function) after a short delay, to avoid
> flicker. It will also log the time taken and payload size for successful
> requests (where payload size is available), and record failures in the logs
> as well.
>
> As I say, it's in need of tidying up -- I wrote it about two and a half
> years ago in a flurry of urgent development, and hasn't really been worked
> on since.
>
> Hopefully it's somewhat helpful to you... I'll try to remember to post an
> updated version when I rework it!
>
> -Barry
>
>
> On 28/11/11 14:16, Philip Thompson wrote:
>
> That's a good idea. I'll look into implementing that. Do you happen to
> have any code available for reference that you may share?
>
>  Thanks,
> ~Philip
>
>
>  On Nov 27, 2011, at 11:55 PM, Barry van Oudtshoorn wrote:
>
>  What you can do (in fact, what I did) is write a thin wrapper around the
> Request object. You can then extend this wrapper to transparently handle
> things like file uploads and JSONP through the same (or a very similar)
> interface, as well as have it automatically retry requests that fail. I
> also use this class to ensure that requests, their times, and their size
> are logged -- I can then get clients to forward these data through to me,
> which facilitates debugging.
>
> In my implementation, I only show a "please wait" message after a short
> moment (around 250ms) -- this way, really quick requests (which should
> dominate) won't cause unsightly flickers. Using the wrapper also means that
> I can ensure that only one message is shown, rather than stacking them.
>
> - Barry
>
> On 28/11/11 13:39, Philip Thompson wrote:
>
> Not exactly what I'm looking for because I don't want to add the spinner
> options to every request object - I want to add the spinner to the Request
> prototype. Is it possible to add the spinner options to the prototype and
> have it applied to all Requests?
>
>  Thanks,
> ~Philip
>
>
>  On Nov 27, 2011, at 10:25 PM, Aaron Newton wrote:
>
>  See Spinner in MooTools More.
>
>
> On Nov 27, 2011, at 8:13 PM, Philip Thompson <[email protected]>
> wrote:
>
>  Hi all.
>
>  It seems like I've seen something similar before, but I can't seem to
> find it. I am wanting to show a default "Loading…" message/icon when a
> Request occurs. In a previous project several years ago, I (re-)implemented
> the methods necessary in Request to add the loader to every request. It
> seems like there should be an easier way. David has done some similar
> functionality here (
> http://davidwalsh.name/dwrequest-mootools-12-ajax-listener-message), but
> I don't want to call a custom class, I just want to use the base
> Request(.HTML/.JSON) class with this added functionality.
>
>  I tried overwriting the main request class, but the onRequest and
> onComplete methods never seem to get called.
> http://jsfiddle.net/philthathril/kpAUC/
>
>  What is the proper way to accomplish this? Is there already a solution
> out there that I just can't find?
>
>  Thanks in advance,
> ~Philip
>
> --
> http://lonestarlightandsound.com/
>
>
>
> --
> Barry van Oudtshoornwww.barryvan.com.au
>
> Not sent from my Apple πPhone.
>
>
>
> --
> Barry van Oudtshoornwww.barryvan.com.au
>
> Not sent from my Apple πPhone.
>
>


-- 
http://lonestarlightandsound.com/

Reply via email to