From 4b34ce374bafbe78ccc80dc139911142c6188547 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 23 Jan 2025 09:23:51 +0800 Subject: [PATCH] Optimize code size for scheduler.ts. (#18236) --- cocos/core/scheduler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cocos/core/scheduler.ts b/cocos/core/scheduler.ts index b20cf206880..0e604863d46 100644 --- a/cocos/core/scheduler.ts +++ b/cocos/core/scheduler.ts @@ -44,6 +44,7 @@ export interface ISchedulable { * @en A list double-linked list used for "updates with priority". * @zh 用于“优先更新”的列表。 * @class ListEntry + * @mangle */ class ListEntry { public static get (target: ISchedulable, priority: number, paused: boolean, markedForDeletion: boolean): ListEntry { @@ -105,6 +106,7 @@ class ListEntry { * @param entry @en Entry in the list. @zh 所述的条目。 * @param target @en Hash key (retained). @zh 哈希键所对应的目标(被持有的)。 * @param callback @en The callback function. @zh 所回调的函数。 + * @mangle */ class HashUpdateEntry { public static get (list: ListEntry[], entry: ListEntry, target: ISchedulable, callback: AnyFunction | null): HashUpdateEntry { @@ -151,6 +153,7 @@ class HashUpdateEntry { * @param currentTimer * @param currentTimerSalvaged * @param paused + * @mangle */ class HashTimerEntry { public static get (timers: CallbackTimer[] | null, target: ISchedulable, timerIndex: number, currentTimer: CallbackTimer | null, currentTimerSalvaged: boolean, paused: boolean): HashTimerEntry { @@ -196,8 +199,9 @@ class HashTimerEntry { type CallbackType = (dt?: number) => void; -/* +/** * Light weight timer + * @mangle */ class CallbackTimer { public static _timers: CallbackTimer[] = []; @@ -755,6 +759,7 @@ export class Scheduler extends System { * @param timerToUnschedule The timer to be unscheduled. * @param target The target of the timer. * @engineInternal + * @mangle */ public unscheduleForTimer (timerToUnschedule: CallbackTimer, target: ISchedulable): void { const targetId = (target.uuid || target.id) as string;