import { InformationSource } from '../../reporter/information_source.js';
import { Reporter } from '../../reporter/reporter.js';
import { UUIDRegex, checkPropTypes } from '../../lib.js';
// LoadingBase needs to get a type, so I can have
// a central materials base.
// which types are there? as many as loadable component types
// exr, image, geometry, gltf
/** Block category */
class LoadingBase extends InformationSource {
/**
* @param {Reporter} reporter
* @param {Object} settings
* @param {UUID} [settings.id]
* @param {string} [settings.name]
* @param {string[]} [settings.for] - a free field to indicate the asset types this loading base provides
* @param {URL} settings.url
*/
constructor( reporter, settings ) {
super(reporter, settings );
// console.error(settings)
if ( ! settings.for ) {
console.warn('Setting LoadingBase `for` property to `default`');
settings.for = ['default'];
}
checkPropTypes(
settings,
{
url: URL,
for: val => {
return Array.isArray(val) && val.every(entry => typeof( entry ) === 'string')
},
},
{}
);
if ( settings.url.href.substr(-1) !== '/') {
settings.url.href += '/';
}
this.url = settings.url;
this.for = settings.for;
this.name = settings.name;
}
}
export { LoadingBase };