UNPKG

@awesome-ecs/abstract

Version:

A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.

137 lines 4.28 kB
//#region src/utils/json-serializer.d.ts /** * A custom `IJsonSerializer` interface allows for different ways of serializing and parsing objects. */ interface IJsonSerializer { /** * Serializes the given object into a JSON string. * * @param value The object to be serialized. * @returns A JSON string representation of the object. */ serializeCustom(value: object): string; /** * Parses a JSON string into the specified object type. * * @template TObject The type of the object to be parsed. * @param text The JSON string to be parsed. * @returns The parsed object of type `TObject`. */ parseCustom<TObject>(text: string): TObject; } //#endregion //#region src/utils/logger.d.ts /** * An ILogger instance allows printing messages to console or other targets. */ interface ILogger { /** * Logs a message with a specified level. * @param level The level of the message. * @param message The message to be logged. * @param ...args Additional arguments to be included in the message. */ log(level: LogLevel, message: any, ...args: any[]): void; /** * Logs a trace-level message. * @param message The message to be logged. * @param ...args Additional arguments to be included in the message. */ trace(message: any, ...args: any[]): void; /** * Logs a debug-level message. * @param message The message to be logged. * @param ...args Additional arguments to be included in the message. */ debug(message: any, ...args: any[]): void; /** * Logs a warning-level message. * @param message The message to be logged. * @param ...args Additional arguments to be included in the message. */ warn(message: any, ...args: any[]): void; /** * Logs an error-level message. * @param message The message to be logged. * @param ...args Additional arguments to be included in the message. */ error(message: any, ...args: any[]): void; } /** * An enumeration of log levels. */ declare enum LogLevel { /** * Trace-level logging. */ trace = 0, /** * Debug-level logging. */ debug = 1, /** * Warning-level logging. */ warn = 2, /** * Error-level logging. */ error = 3, } /** * Options for configuring an ILogger instance. */ interface ILoggerOptions { /** * A map of log levels to their corresponding enabled status. */ enabled: Map<LogLevel, boolean>; } //#endregion //#region src/utils/performance-timer.d.ts /** * A unique identifier for a timer. */ type PerformanceTimerUid = number; /** * A record of a timer's execution. * * @remarks * This interface represents the details of a timer's execution. * It includes the timer's name, start timestamp, end timestamp, and the duration of the timer's execution in milliseconds. * * @property {string} name - The name of the timer. * @property {number} startedAt - The timestamp when the timer started. * @property {number} [endedAt] - The timestamp when the timer ended. * @property {number} [msPassed] - The time in milliseconds that the timer was active. */ interface PerformanceTimeEntry { name: string; startedAt: number; endedAt?: number; msPassed?: number; } /** * An interface for a performance timer. * This interface provides methods to start and end timers, * and retrieve information about their execution. */ interface IPerformanceTimer { /** * Starts a new timer with the given name. * @param {string} name - The name of the timer. * @returns {PerformanceTimerUid} - A unique identifier for the newly started timer. */ startTimer(name: string): PerformanceTimerUid; /** * Ends the timer with the given timerUid and returns a record of its execution. * @param {PerformanceTimerUid} timerUid - The unique identifier of the timer to end. * @returns {PerformanceTimeEntry} - A record of the timer's execution. * The returned object contains the timer's name, start timestamp, end timestamp, * and the duration of the timer's execution in milliseconds. */ endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry; } //#endregion export { IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, LogLevel, PerformanceTimeEntry, PerformanceTimerUid }; //# sourceMappingURL=index-oenqxDCa.d.ts.map