diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-08-29 01:57:35 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-08-29 01:57:59 +0200 |
commit | 92c782c1b049cbb4b9c8433edec2a08b739202a9 (patch) | |
tree | 8727af416595d605f0f0c1074ebd4cd4a5e7f24d /core/js | |
parent | d786194ddc0c2f14cccc8bf80ecc2d397b684825 (diff) | |
download | nextcloud-server-92c782c1b049cbb4b9c8433edec2a08b739202a9.tar.gz nextcloud-server-92c782c1b049cbb4b9c8433edec2a08b739202a9.zip |
return the jQuery deferred object when using OC.loadScript
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/js/js.js b/core/js/js.js index 0c842f05593..c38eebbff29 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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 |