2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2018-01-25 23:19:23 +00:00
|
|
|
var Extend = require('../utils/object/Extend');
|
2016-11-30 00:18:34 +00:00
|
|
|
var XHRSettings = require('./XHRSettings');
|
|
|
|
|
2018-02-08 17:00:14 +00:00
|
|
|
/**
|
|
|
|
* Takes two XHRSettings Objects and creates a new XHRSettings object from them.
|
|
|
|
*
|
|
|
|
* The new object is seeded by the values given in the global settings, but any setting in
|
|
|
|
* the local object overrides the global ones.
|
|
|
|
*
|
|
|
|
* @function Phaser.Loader.MergeXHRSettings
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Loader.XHRSettings} global - The global XHRSettings object.
|
|
|
|
* @param {Phaser.Loader.XHRSettings} local - The local XHRSettings object.
|
|
|
|
*
|
|
|
|
* @return {Phaser.Loader.XHRSettings} A newly formed XHRSettings object.
|
|
|
|
*/
|
2016-11-30 00:18:34 +00:00
|
|
|
var MergeXHRSettings = function (global, local)
|
|
|
|
{
|
2018-01-25 23:19:23 +00:00
|
|
|
var output = (global === undefined) ? XHRSettings() : Extend(global);
|
2016-11-30 00:18:34 +00:00
|
|
|
|
|
|
|
if (local)
|
|
|
|
{
|
|
|
|
for (var setting in local)
|
|
|
|
{
|
|
|
|
if (local[setting] !== undefined)
|
|
|
|
{
|
|
|
|
output[setting] = local[setting];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = MergeXHRSettings;
|