Allows to abort all ajax calls in the controller without releasing whole controller.

This commit is contained in:
Mantas 2019-01-11 11:53:10 +02:00 committed by Thorsten Eckel
parent 9e5318fdb5
commit 1694094ea5

View file

@ -74,9 +74,18 @@ class App.Controller extends Spine.Controller
App.Event.unbindLevel(@controllerId) App.Event.unbindLevel(@controllerId)
App.Delay.clearLevel(@controllerId) App.Delay.clearLevel(@controllerId)
App.Interval.clearLevel(@controllerId) App.Interval.clearLevel(@controllerId)
if @ajaxCalls @abortAjaxCalls()
for callId in @ajaxCalls
App.Ajax.abort(callId) abortAjaxCalls: =>
if !@ajaxCalls
return
idsToCancel = @ajaxCalls
@ajaxCalls = []
for callId in idsToCancel
App.Ajax.abort(callId)
release: -> release: ->
# release custom bindings after it got removed from dom # release custom bindings after it got removed from dom