@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
45 lines (39 loc) • 1.21 kB
JavaScript
import { combine_hash } from "../../../../../core/collection/array/combine_hash.js";
import { computeObjectHash } from "../../../../../core/math/hash/computeObjectHash.js";
import { objectDeepEquals } from "../../../../../core/model/object/objectDeepEquals.js";
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
export class AnimationNotificationDefinition {
constructor() {
/**
* Event name to be dispatched during the notification
* @type {string}
*/
this.event = "";
/**
* Data to be sent with the event
* @type {*}
*/
this.data = {};
}
/**
*
* @param {AnimationNotificationDefinition} other
* @returns {boolean}
*/
equals(other) {
if (this === other) {
return true;
}
return this.event === other.event
&& objectDeepEquals(this.data, other.data);
}
/**
* @returns {number}
*/
hash() {
return combine_hash(
computeStringHash(this.event),
computeObjectHash(this.data)
);
}
}