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,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
|
||||||
|
|
Loading…
Reference in a new issue