Browse Source

Let DataUtils create method have a callback.

Bentley James Oakes 7 years ago
parent
commit
dd77ada1b8
1 changed files with 12 additions and 9 deletions
  1. 12 9
      client/data_utils.js

+ 12 - 9
client/data_utils.js

@@ -50,15 +50,18 @@ DataUtils = function(){
 	 * Request creation of an instance of __typeToCreate at the specified
 	 * x and y coordinates
 	 */
-	this.create = function(x,y){
-		if( __typeToCreate != undefined )
-			HttpUtils.httpReq(
-					'POST',
-					HttpUtils.url(__typeToCreate+'.type',__NO_USERNAME),
-					{'pos':[x,y]});
-		else
-			WindowManagement.openDialog(_ERROR,'you must select a type to create');
-	};
+    this.create = function (x, y, callback) {
+        if (__typeToCreate == undefined) {
+            WindowManagement.openDialog(_ERROR, 'you must select a type to create');
+        } else {
+            HttpUtils.httpReq(
+                'POST',
+                HttpUtils.url(__typeToCreate + '.type', __NO_USERNAME),
+                {'pos': [x, y]},
+                callback);
+        }
+
+
 	
 	/**
 	 * Deletes the current selection entities