Skip to content

Commit

Permalink
[FIX] Synchronous loading of scripts that are already loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
vkalpias committed Dec 7, 2015
1 parent 20ecba8 commit 873630d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/framework/components/script/script_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,16 @@ pc.extend(pc, function () {
var i, len;
var cached = [];

var prefix = this.system._prefix || "";
var regex = /^http(s)?:\/\//i;

for (i = 0, len = urls.length; i < len; i++) {
var type = this.system.app.loader.getFromCache(urls[i]);
var url = urls[i];
if (! regex.test(url)) {
url = pc.path.join(prefix, url);
}

var type = this.system.app.loader.getFromCache(url, 'script');

// if we cannot find the script in the cache then return and load
// all scripts with the resource loader
Expand Down

0 comments on commit 873630d

Please sign in to comment.