File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class TimeContext extends EventEmitter {
42
42
this . activeClock = undefined ;
43
43
this . offsets = undefined ;
44
44
this . mode = undefined ;
45
+ this . warnCounts = { } ;
45
46
46
47
this . tick = this . tick . bind ( this ) ;
47
48
}
@@ -648,6 +649,17 @@ class TimeContext extends EventEmitter {
648
649
}
649
650
650
651
#warnMethodDeprecated( method , newMethod ) {
652
+ const MAX_CALLS = 1 ; // Only warn once per unique method and newMethod combination
653
+
654
+ const key = `${ method } .${ newMethod } ` ;
655
+ const currentWarnCount = this . warnCounts [ key ] || 0 ;
656
+
657
+ if ( currentWarnCount >= MAX_CALLS ) {
658
+ return ; // Don't warn if already warned once
659
+ }
660
+
661
+ this . warnCounts [ key ] = currentWarnCount + 1 ;
662
+
651
663
let message = `[DEPRECATION WARNING]: The ${ method } API method is deprecated and will be removed in a future version of Open MCT.` ;
652
664
653
665
if ( newMethod ) {
You can’t perform that action at this time.
0 commit comments