fgnass / spin.js

A spinning activity indicator
http://spin.js.org
MIT License
9.3k stars 1.02k forks source link

spinner stops automatically after fix interval of time #268

Closed piu closed 9 years ago

piu commented 9 years ago

Hello there,

I an using spin.js in my application and I need to stop spinner automatically if server response is late. For eg: On starting of request I start the Spinner and after 10 sec or so it should get stop automatically even if server response fails/ is slow.

Is there any way to acheive this in Spin.js?

piu commented 9 years ago

Hi I have made some Changes in Spin.js and Typescript file for same in order to fix it in my Application. Introduced new Parameters: 1) stopTimer?: number; 2) autoStop?: boolean;

And handled the same in Spin.js you can find changes in my repository (https://github.com/piu/SpinJSWithAutoStop )

fgnass commented 9 years ago

If you use jQuery.ajax() provide a timeout and stop the spinner in the error callback. See http://stackoverflow.com/questions/5225597/set-timeout-for-ajax-jquery

PapillonUK commented 9 years ago

I have to agree - I don't think stopping the spinner after a certain amount of time is a common requirement.

On Saturday, 20 December 2014, Felix Gnass notifications@github.com wrote:

If you use jQuery.ajax() provide a timeout and stop the spinner in the error callback. See http://stackoverflow.com/questions/5225597/set-timeout-for-ajax-jquery

— Reply to this email directly or view it on GitHub https://github.com/fgnass/spin.js/issues/268#issuecomment-67751670.

piu commented 9 years ago

Yes I agree, its pretty convenient to do so if using jquery.ajax() but in my case we are using Signalr.