@awesome-ecs/abstract
Version:
A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.
1 lines • 2.14 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/entities/entity-queue.ts"],"sourcesContent":["import { IEntityModel } from './entity';\nimport { IEntityProxy } from './entity-proxies';\nimport { IEntitySnapshot } from './entity-snapshot';\n\n/**\n * The `EntityUpdateType` enum specifies whether the current Entity should be `updated` or `removed`.\n */\nexport enum EntityUpdateType {\n update = 'update',\n remove = 'remove'\n}\n\n/**\n * The `IEntityUpdate` interface represents an Entity update that should be applied over an existing Entity.\n */\nexport interface IEntityUpdate {\n /**\n * The type of the update, which can be either `update` or `remove`.\n */\n type: EntityUpdateType;\n\n /**\n * The proxy of the Entity that needs to be updated.\n */\n entity: IEntityProxy;\n\n /**\n * Optional. The model of the Entity that needs to be updated.\n */\n model?: IEntityModel;\n\n /**\n * Optional. The snapshot of the Entity that needs to be updated.\n */\n snapshot?: IEntitySnapshot;\n}\n\n/**\n * The `IEntityUpdateQueue` interface is the main mechanism to queue and retrieve `EntityUpdate` instances.\n *\n * The interface can be implemented using a simple queue mechanism, or perhaps, a Priority Queue.\n */\nexport interface IEntityUpdateQueue {\n /**\n * The number of `EntityUpdate` instances currently in the queue.\n */\n readonly size: number;\n\n /**\n * Adds an `EntityUpdate` instance to the end of the queue.\n * @param change - The `EntityUpdate` instance to be added.\n */\n enqueue(change: IEntityUpdate): void;\n\n /**\n * Removes and returns the `EntityUpdate` instance at the front of the queue.\n * @returns The `EntityUpdate` instance at the front of the queue.\n */\n dequeue(): IEntityUpdate;\n\n /**\n * Returns the `EntityUpdate` instance at the front of the queue without removing it.\n * @returns The `EntityUpdate` instance at the front of the queue.\n */\n peek(): IEntityUpdate;\n\n /**\n * Removes all `EntityUpdate` instances from the queue.\n */\n clear(): void;\n}\n"],"mappings":";;;;;AAOA,IAAY,gEAAL;AACL;AACA;;AACD"}