diff --git a/openbis/sourceTest/javascript/simpleapp/openbis.js b/openbis/sourceTest/javascript/simpleapp/openbis.js
index 3b6bb915df472321821bc40da40d54d4a58c3517..e35025bfb4377979b4dfef992b07bb0153ace058 100644
--- a/openbis/sourceTest/javascript/simpleapp/openbis.js
+++ b/openbis/sourceTest/javascript/simpleapp/openbis.js
@@ -309,3 +309,35 @@ openbis.prototype.executeQuery = function(queryId, parameterBindings, action) {
 		success: action
 	});
 }
+
+/**
+ * A utility class for deferring an action until all of some kind of action has completed
+ *
+ * @argument dependencies An array of the keys for the dependencies.
+ */
+function actionDeferrer(pendingAction, dependencies) {
+	this.pendingAction = pendingAction;
+	this.dependencies = {};
+	var newme = this;
+	dependencies.forEach(function(key) {
+		newme.dependencies[key] = false;
+	});
+}
+
+/**
+ * Note that a dependency completed. Execute the pending action if appropriate.
+ */
+actionDeferrer.prototype.dependencyCompleted = function(key) {
+	this.dependencies[key] = true;
+	var shouldExecute = true;
+	for (prop in this.dependencies) {
+		if (false == this.dependencies[prop]) {
+			shouldExecute = false;
+			break;
+		}
+	}
+	if (shouldExecute) {
+		this.pendingAction();
+	}
+}
+