|
@@ -4,6 +4,7 @@ var RenderQueue = TaskQueue.extend({
|
|
|
waitsByNamespace: null,
|
|
waitsByNamespace: null,
|
|
|
waitNamespace: null,
|
|
waitNamespace: null,
|
|
|
waitId: null,
|
|
waitId: null,
|
|
|
|
|
+ isKilled: false, // prevents any new tasks from being added
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor: function(waitsByNamespace) {
|
|
constructor: function(waitsByNamespace) {
|
|
@@ -14,6 +15,11 @@ var RenderQueue = TaskQueue.extend({
|
|
|
|
|
|
|
|
|
|
|
|
|
queue: function(namespace, type, taskFunc) {
|
|
queue: function(namespace, type, taskFunc) {
|
|
|
|
|
+
|
|
|
|
|
+ if (this.isKilled) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
var task = {
|
|
var task = {
|
|
|
func: taskFunc,
|
|
func: taskFunc,
|
|
|
namespace: namespace,
|
|
namespace: namespace,
|
|
@@ -47,6 +53,18 @@ var RenderQueue = TaskQueue.extend({
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ Prevents any new tasks from being added AND clears all tasks related to rendering *new* things,
|
|
|
|
|
+ however, keeps destroy-related tasks to allow proper cleanup.
|
|
|
|
|
+ */
|
|
|
|
|
+ kill: function() {
|
|
|
|
|
+ this.isKilled = true;
|
|
|
|
|
+ this.q = this.q.filter(function(task) {
|
|
|
|
|
+ return task.type === 'destroy-trigger' || task.type === 'destroy';
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
startWait: function(namespace, waitMs) {
|
|
startWait: function(namespace, waitMs) {
|
|
|
this.waitNamespace = namespace;
|
|
this.waitNamespace = namespace;
|
|
|
this.spawnWait(waitMs);
|
|
this.spawnWait(waitMs);
|