Created
February 27, 2024 02:46
-
-
Save colelawrence/e81e280b1fd1887adb1e3f7ad4ca0b0d to your computer and use it in GitHub Desktop.
Warn console messages only once.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const warned = new Set<string>(); | |
export function warnOnce(message: string) { | |
if (!warned.has(message)) { | |
warned.add(message); | |
console.warn(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment