@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
58 lines (51 loc) • 1.25 kB
JavaScript
import { assert } from "../../core/assert.js";
import { combine_hash } from "../../core/collection/array/combine_hash.js";
import { computeStringHash } from "../../core/primitives/strings/computeStringHash.js";
export class AssetDescription {
/**
*
* @param {string} path
* @param {string} type
* @constructor
*/
constructor(path, type) {
assert.isString(path, 'path');
assert.isString(type, 'type');
/**
* @type {string}
*/
this.path = path;
/**
* @type {string}
*/
this.type = type;
}
/**
*
* @param {AssetDescription} other
* @returns {boolean}
*/
equals(other) {
return this.path === other.path
&& this.type === other.type
;
}
/**
*
* @returns {number}
*/
hash() {
return combine_hash(
computeStringHash(this.path),
computeStringHash(this.type)
);
}
toString() {
return `{ type: '${this.type}', path: '${this.path}' }`;
}
}
/**
* @readonly
* @type {boolean}
*/
AssetDescription.prototype.isAssetDescription = true;