Skip to content

Commit

Permalink
Merge pull request #86 from bigtimebuddy/master
Browse files Browse the repository at this point in the history
Expose the extension publicly
  • Loading branch information
englercj authored Feb 3, 2017
2 parents 00a56a7 + 8a9574a commit 7a70cb2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ export default class Resource {
*/
this.url = url;

/**
* The extension used to load this resource.
*
* @member {string}
* @readonly
*/
this.extension = this._getExtension();

/**
* The data that was loaded by the resource.
*
Expand Down Expand Up @@ -815,7 +823,7 @@ export default class Resource {
* @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.
*/
_determineXhrType() {
return Resource._xhrTypeMap[this._getExtension()] || Resource.XHR_RESPONSE_TYPE.TEXT;
return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;
}

/**
Expand All @@ -826,7 +834,7 @@ export default class Resource {
* @return {Resource.LOAD_TYPE} The loadType to use.
*/
_determineLoadType() {
return Resource._loadTypeMap[this._getExtension()] || Resource.LOAD_TYPE.XHR;
return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;
}

/**
Expand Down

0 comments on commit 7a70cb2

Please sign in to comment.