Skip to content

Commit 20c8119

Browse files
authored
Merge pull request #114 from rpgtkoolmv/for-official
patch for merging to official
2 parents d79f4ff + 08e19f1 commit 20c8119

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

js/rpg_core/WebAudio.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ function WebAudio() {
1010
this.initialize.apply(this, arguments);
1111
}
1212

13+
WebAudio._standAlone = (function(top){
14+
return !top.ResourceHandler;
15+
})(this);
16+
1317
WebAudio.prototype.initialize = function(url) {
1418
if (!WebAudio._initialized) {
1519
WebAudio.initialize();
1620
}
1721
this.clear();
18-
this._loader = ResourceHandler.createLoader(url, this._load.bind(this, url), function() {
19-
this._hasError = true;
20-
}.bind(this));
22+
23+
if(!WebAudio._standAlone){
24+
this._loader = ResourceHandler.createLoader(url, this._load.bind(this, url), function() {
25+
this._hasError = true;
26+
}.bind(this));
27+
}
2128
this._load(url);
2229
this._url = url;
2330
};
@@ -500,7 +507,7 @@ WebAudio.prototype._load = function(url) {
500507
this._onXhrLoad(xhr);
501508
}
502509
}.bind(this);
503-
xhr.onerror = this._loader;
510+
xhr.onerror = this._loader || function(){this._hasError = true;}.bind(this);
504511
xhr.send();
505512
}
506513
};

0 commit comments

Comments
 (0)