Allows to abort all ajax calls in the controller without releasing whole controller.
This commit is contained in:
parent
9e5318fdb5
commit
1694094ea5
1 changed files with 12 additions and 3 deletions
|
@ -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: ->
|
||||||
|
|
Loading…
Reference in a new issue