<commit_before>var ResourceLoader = require('resource-loader'),
    textureParser = require('./textureParser'),
    spritesheetParser = require('./spritesheetParser'),
    particleParser = require('./particleParser'),
    bitmapFontXMLParser = require('./bitmapFontXMLParser'),
    audioParser = require('./audioParser'),
    audioSupportCheck = require('./audioSupportCheck'),
    bitmapFontTXTParser = require('./bitmapFontTXTParser'),
    Device = require('../core/Device');

function AssetLoader(game, baseUrl, concurrency){
    this._init(game, baseUrl, concurrency);
}

AssetLoader.prototype = Object.create(ResourceLoader.prototype);
AssetLoader.prototype.constructor = AssetLoader;

AssetLoader.prototype._init = function(game, baseUrl, concurrency){
    ResourceLoader.call(this, baseUrl, concurrency);
    this.game = game;

    this.setAudioType();

    this.before(audioSupportCheck())
        .use(ResourceLoader.middleware.parsing.blob())
        .use(spritesheetParser())
        .use(textureParser())
        .use(bitmapFontXMLParser())
        .use(particleParser())
        .use(bitmapFontTXTParser())
        .use(audioParser());
};

module.exports = AssetLoader;

AssetLoader.prototype.setAudioType = function(){
    var allowed = this.game.config.audio.allowedExtensions;
    var canPlay = [];
    for (var i = 0; i < allowed.length; i++) {
        var can = false;
        switch (allowed[i]) {
            case "m4a":
                can = Device.hasM4a;
                break;
            case "mp3":
                can = Device.hasMp3;
                break;
            case "ogg":
                can = Device.hasOgg;
                break;
            case "wav":
                can = Device.hasWav;
                break;
        }

        if (can) {
            canPlay.push(allowed[i]);
        }
    }

    for(var n = 0; n < canPlay.length; n++){
        if(this.game.isWebAudio){
            Resource.setExtensionXhrType(canPlay[n], Resource.XHR_RESPONSE_TYPE.BUFFER);
        }else{
            Resource.setExtensionLoadType(canPlay[n], Resource.LOAD_TYPE.AUDIO);
        }
    }

    return this;
};

// Add custom extentions
var Resource = ResourceLoader.Resource;

Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT);<commit_msg>minor fix<commit_after>var ResourceLoader = require('resource-loader'),
    textureParser = require('./textureParser'),
    spritesheetParser = require('./spritesheetParser'),
    particleParser = require('./particleParser'),
    bitmapFontXMLParser = require('./bitmapFontXMLParser'),
    audioParser = require('./audioParser'),
    audioSupportCheck = require('./audioSupportCheck'),
    bitmapFontTXTParser = require('./bitmapFontTXTParser'),
    Device = require('../core/Device');

function AssetLoader(game, baseUrl, concurrency){
    this._init(game, baseUrl, concurrency);
}

AssetLoader.prototype = Object.create(ResourceLoader.prototype);
AssetLoader.prototype.constructor = AssetLoader;

AssetLoader.prototype._init = function(game, baseUrl, concurrency){
    ResourceLoader.call(this, baseUrl, concurrency);
    this.game = game;

    this.setAudioType();

    this.before(audioSupportCheck())
        .use(ResourceLoader.middleware.parsing.blob())
        .use(spritesheetParser())
        .use(textureParser())
        .use(bitmapFontXMLParser())
        .use(particleParser())
        .use(bitmapFontTXTParser())
        .use(audioParser());
};

module.exports = AssetLoader;

AssetLoader.prototype.setAudioType = function(){
    var allowed = this.game.config.audio.allowedExtensions;
    var canPlay = [];
    for (var i = 0; i < allowed.length; i++) {
        var can = false;
        switch (allowed[i]) {
            case "m4a":
                can = Device.hasM4a;
                break;
            case "mp3":
                can = Device.hasMp3;
                break;
            case "ogg":
                can = Device.hasOgg;
                break;
            case "wav":
                can = Device.hasWav;
                break;
        }

        if (can) {
            canPlay.push(allowed[i]);
        }
    }

    for(var n = 0; n < canPlay.length; n++){
        if(this.game.isWebAudio){
            Resource.setExtensionXhrType(canPlay[n], Resource.XHR_RESPONSE_TYPE.BUFFER);
        }else{
            Resource.setExtensionLoadType(canPlay[n], Resource.LOAD_TYPE.AUDIO);
        }
    }

    return this;
};

// Add custom extentions
var Resource = ResourceLoader.Resource;

//Resource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.TEXT);
{'fraction_non_alphanumeric': 0.12980769230769232, 'fraction_numerical': 0.0026223776223776225, 'mean_word_length': 2.5316358024691357, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3188457', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1295, 'n_words': 228}