github.com/grafana/pyroscope@v1.18.0/public/app/util/features.ts (about)

     1  import { z } from 'zod';
     2  
     3  const featuresSchema = z.object({
     4    exportToFlamegraphDotComEnabled: z.boolean().default(true),
     5  });
     6  
     7  function hasFeatures(
     8    window: unknown
     9  ): window is typeof window & { features: unknown } {
    10    if (typeof window === 'object') {
    11      if (window && window.hasOwnProperty('features')) {
    12        return true;
    13      }
    14    }
    15  
    16    return false;
    17  }
    18  
    19  const features = featuresSchema.parse(
    20    hasFeatures(window) ? window.features : {}
    21  );
    22  
    23  export const isExportToFlamegraphDotComEnabled =
    24    features.exportToFlamegraphDotComEnabled;