]> source.dussan.org Git - nextcloud-server.git/commitdiff
return the jQuery deferred object when using OC.loadScript
authorRobin Appelman <icewind@owncloud.com>
Tue, 28 Aug 2012 23:57:35 +0000 (01:57 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 28 Aug 2012 23:57:59 +0000 (01:57 +0200)
core/js/js.js

index 0c842f05593289513ef371733b36c279ab74877f..c38eebbff29fa92dac1112395b19f614e5db1d28 100644 (file)
@@ -120,18 +120,19 @@ OC={
         */
        addScript:function(app,script,ready){
                var path=OC.filePath(app,'js',script+'.js');
-               if(OC.addScript.loaded.indexOf(path)==-1){
-                       OC.addScript.loaded.push(path);
+               if(!OC.addScript.loaded[path]){
                        if(ready){
-                               $.getScript(path,ready);
+                               var deferred=$.getScript(path,ready);
                        }else{
-                               $.getScript(path);
+                               var deferred=$.getScript(path);
                        }
+                       OC.addScript.loaded[path]=deferred;
                }else{
                        if(ready){
                                ready();
                        }
                }
+               return OC.addScript.loaded[path];
        },
        /**
         * load a css file and load it