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,8 +74,17 @@ 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
abortAjaxCalls: =>
if !@ajaxCalls
return
idsToCancel = @ajaxCalls
@ajaxCalls = []
for callId in idsToCancel
App.Ajax.abort(callId) App.Ajax.abort(callId)
release: -> release: ->