mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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:
parent
790221b1d2
commit
c4ad8fb2e7
3 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue