Skip to content

Commit

Permalink
Expose the extension publicly
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Karl committed Feb 3, 2017
1 parent 00a56a7 commit 8a9574a
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 8a9574a

Please sign in to comment.