diff --git a/examples/widgetapp/widget.coffee b/examples/widgetapp/widget.coffee
index b46fab08..b4656ea3 100644
--- a/examples/widgetapp/widget.coffee
+++ b/examples/widgetapp/widget.coffee
@@ -353,10 +353,12 @@ class WSF_PROGRESS_CONTROL extends WSF_CONTROL
self = @
runfetch= ()->
self.fetch()
- setInterval(runfetch, 5000)
+ @int=setInterval(runfetch, 5000)
fetch: ()->
@trigger_callback(@control_name, 'progress_fetch')
+ if @$el.closest('body').length <= 0
+ clearInterval(@int)
update: (state)->
if state.progress?
@@ -428,15 +430,13 @@ start_modal = (action)->
-
-
-
-""")
+
+
+""")
modal.appendTo('body')
- modal.modal()
+ modal.modal('show')
+ modal.on 'hidden.bs.modal', ()->
+ modal.remove()
$.get( action.url, { ajax: 1 } )
.done (data) ->
modal.find('.modal-body').append(data)
diff --git a/examples/widgetapp/widget.js b/examples/widgetapp/widget.js
index e1e75d48..fcd4e37b 100644
--- a/examples/widgetapp/widget.js
+++ b/examples/widgetapp/widget.js
@@ -638,11 +638,14 @@ WSF_PROGRESS_CONTROL = (function(_super) {
runfetch = function() {
return self.fetch();
};
- return setInterval(runfetch, 5000);
+ return this.int = setInterval(runfetch, 5000);
};
WSF_PROGRESS_CONTROL.prototype.fetch = function() {
- return this.trigger_callback(this.control_name, 'progress_fetch');
+ this.trigger_callback(this.control_name, 'progress_fetch');
+ if (this.$el.closest('body').length <= 0) {
+ return clearInterval(this.int);
+ }
};
WSF_PROGRESS_CONTROL.prototype.update = function(state) {
@@ -756,9 +759,12 @@ show_alert = function(action) {
start_modal = function(action) {
var modal;
- modal = $("");
+ modal = $("");
modal.appendTo('body');
- modal.modal();
+ modal.modal('show');
+ modal.on('hidden.bs.modal', function() {
+ return modal.remove();
+ });
return $.get(action.url, {
ajax: 1
}).done(function(data) {