mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): profiler takes null as a default instance (#59233)
Several profiler calls don't have any meaningful instance when producing a profiling event. This commit changes the default instance value to null to sreamline profiler invocations. PR Close #59233
This commit is contained in:
@@ -43,7 +43,7 @@ export class NgProfiler extends Profiler {
|
||||
|
||||
private _initialize(): void {
|
||||
ngDebugClient().ɵsetProfiler(
|
||||
(event: ɵProfilerEvent, instanceOrLView: {} | null, hookOrListener: any) =>
|
||||
(event: ɵProfilerEvent, instanceOrLView: {} | null = null, hookOrListener: any) =>
|
||||
this._callbacks.forEach((cb) => cb(event, instanceOrLView, hookOrListener)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export const setProfiler = (profiler: Profiler | null) => {
|
||||
* execution context
|
||||
* @returns
|
||||
*/
|
||||
export const profiler: Profiler = function (event, instance, hookOrListener) {
|
||||
export const profiler: Profiler = function (event, instance = null, hookOrListener) {
|
||||
if (profilerCallback != null /* both `null` and `undefined` */) {
|
||||
profilerCallback(event, instance, hookOrListener);
|
||||
}
|
||||
|
||||
@@ -160,5 +160,5 @@ export const enum ProfilerEvent {
|
||||
* Profiler function which the runtime will invoke before and after user code.
|
||||
*/
|
||||
export interface Profiler {
|
||||
(event: ProfilerEvent, instance: {} | null, hookOrListener?: (e?: any) => any): void;
|
||||
(event: ProfilerEvent, instance?: {} | null, hookOrListener?: (e?: any) => any): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user