Parcourir la source

omit EventEmittor for client

Yuki Takei il y a 5 mois
Parent
commit
fc9e65b621

+ 0 - 11
apps/app/src/pages/[[...path]].page.tsx

@@ -12,7 +12,6 @@ import type {
 } from '@growi/core';
 import { isIPageInfo } from '@growi/core';
 import { isClient, pagePathUtils, pathUtils } from '@growi/core/dist/utils';
-import EventEmitter from 'events';
 import ExtensibleCustomError from 'extensible-custom-error';
 import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
 import superjson from 'superjson';
@@ -101,11 +100,6 @@ import {
   useInitSidebarConfig,
 } from './utils/commons';
 
-declare global {
-  // eslint-disable-next-line vars-on-top, no-var
-  var globalEmitter: EventEmitter;
-}
-
 const GrowiContextualSubNavigationSubstance = dynamic(
   () => import('~/client/components/Navbar/GrowiContextualSubNavigation'),
   { ssr: false },
@@ -311,11 +305,6 @@ type Props = CommonProps & {
 };
 
 const Page: NextPageWithLayout<Props> = (props: Props) => {
-  // register global EventEmitter
-  if (isClient() && window.globalEmitter == null) {
-    window.globalEmitter = new EventEmitter();
-  }
-
   const router = useRouter();
 
   useCurrentUser(props.currentUser ?? null);

+ 0 - 6
apps/app/src/stores-universal/context.tsx

@@ -1,4 +1,3 @@
-import type EventEmitter from 'node:events';
 import type { ColorScheme, IUserHasId } from '@growi/core';
 import { AcceptedUploadFileType } from '@growi/core';
 import { useSWRStatic } from '@growi/core/dist/swr';
@@ -11,11 +10,6 @@ import type { RendererConfig } from '~/interfaces/services/renderer';
 
 import { useContextSWR } from './use-context-swr';
 
-declare global {
-  // eslint-disable-next-line vars-on-top, no-var
-  var globalEmitter: EventEmitter;
-}
-
 type Nullable<T> = T | null;
 
 export const useAppTitle = (