Skip to content

🎥 Make videos programmatically with React

cache calculation

Jonny Burger8aeb3a7c607a
diff --git a/packages/renderer/src/is-ipv6-supported.ts b/packages/renderer/src/is-ipv6-supported.ts
index 63f81e48a5..3db848bfc7 100644
--- a/packages/renderer/src/is-ipv6-supported.ts
+++ b/packages/renderer/src/is-ipv6-supported.ts
@@ -1,6 +1,8 @@
import os from 'os';
-export const isIpV6Supported = (): boolean => {
+let cache: null | boolean = null;
+
+const calculate = (): boolean => {
const interfaces = os.networkInterfaces();
for (const iface in interfaces) {
@@ -15,3 +17,11 @@ export const isIpV6Supported = (): boolean => {
return false;
};
+
+export const isIpV6Supported = (): boolean => {
+ if (cache === null) {
+ cache = calculate();
+ }
+
+ return cache;
+};