On Sun, Apr 29, 2012 at 11:01 AM, John Whitley <bangpath....
> Raul Rangel wrote:
>> The errback idea is nice, but I think its a little to verbose and it feels a little too RequireJS.
I have filed this issue to track this request:
My first inclination, if there is a paths array, then no indication of
state in any additional errbacks listed. Although that implies that
there is a way for an errback to indicate "I handled the error, do not
notify other errback listeners for this error", and the paths array
auto-errback wiring would cancel on handling the error.
If anyone wants to comment more on this/follow it, leave a comment in
the bug above.
> I like Raul's idea of a fallback array at first glance. That seems to cover the common case and it's cleaner than everyone using a CDN copying each other's boilerplate function template around. I'd likewise second the motion for the errback function receiving the retry list and current retry state. Effectively this would mean that require.js would provide a default errback function which could be overridden by users. This would let users tweak and refine this logic for their needs. Much like the experience with plugins, generally useful improvements could be factored out for inclusion in require.js' default implementation.
> I'd also like to see some clarification on the scope and API footprint of the errback function. For example, is it only intended to be called on the first require() call (e.g. via data-main's code)? That implies persistence. If that's the case, I'd almost prefer specifying it via the config. Also, what happens if another errback function is supplied by other code later on? Does it override the original globally? Or just for that call?
There can be many error listeners for a given module failure, and they
apply for any module in a given module's dependency tree. As mentioned
above, I think there needs to be a way for an error handler to mention
it has handled the error, so do not keep notifying.
On the config option for an errback: My first thought is that it may
not be needed, the most common case would be to wire fallback urls,
but if that is provided via a paths array support, is that enough?