Turn the save function into a callback-driven one. Probably needs renaming now
authorAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:02 +0000 (17:04 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:02 +0000 (17:04 +0000)
net/systemeD/potlatch2/save/SaveManager.as

index 1d90ab7..6a3843b 100644 (file)
@@ -15,19 +15,19 @@ package net.systemeD.potlatch2.save {
         private var consumer:OAuthConsumer;
 
         public static function saveChanges():void {
-            instance.save();
+            instance.save(instance.saveData);
         }
-        
-        private function save():void {
+
+        private function save(callback:Function):void {
             if ( consumer == null )
                 consumer = getConsumer();
             if ( accessToken == null )
                 accessToken = getAccessToken();
         
             if ( accessToken == null )
-                getNewToken(saveData);
+                getNewToken(callback);
             else
-                saveData();
+                callback();
         }
     
         private function getAccessToken():OAuthToken {