import launchDarklyBrowser from "ldclient-js";

export function ldBrowserInit (key, user) {
  return launchDarklyBrowser.initialize(key, user);
}

export function getAllFeatureFlags (key, user) {
  const ldClient = ldBrowserInit(key, user);
  return new Promise((resolve, reject) => {
    ldClient.on("ready", () => {
      resolve(ldClient.allFlags());
    });
  });
}

import launchDarklyBrowser from "ldclient-js";

export function ldBrowserInit (key, user) {
  return launchDarklyBrowser.initialize(key, user);
}

export function getAllFeatureFlags (key, user) {
  const ldClient = ldBrowserInit(key, user);
  return ldClient.allFlags();
}

--- 
+++ 
@@ -6,5 +6,9 @@
 
 export function getAllFeatureFlags (key, user) {
   const ldClient = ldBrowserInit(key, user);
-  return ldClient.allFlags();
+  return new Promise((resolve, reject) => {
+    ldClient.on("ready", () => {
+      resolve(ldClient.allFlags());
+    });
+  });
 }
Refactor grabbing all feature flags to implement a promise
