MCPcopy Create free account
hub / github.com/dailydotdev/apps / initReactModal

Function initReactModal

packages/shared/src/lib/func.ts:237–264  ·  view source on GitHub ↗
({
  modalObject,
  appElement,
  defaultStyles,
}: {
  modalObject: {
    setAppElement: (element: string | HTMLElement) => void;
    defaultStyles: ReactModal.Styles;
  };
  appElement: string | HTMLElement;
  defaultStyles?: ReactModal.Styles;
})

Source from the content-addressed store, hash-verified

235};
236
237export const initReactModal = ({
238 modalObject,
239 appElement,
240 defaultStyles,
241}: {
242 modalObject: {
243 setAppElement: (element: string | HTMLElement) => void;
244 defaultStyles: ReactModal.Styles;
245 };
246 appElement: string | HTMLElement;
247 defaultStyles?: ReactModal.Styles;
248}): void => {
249 const runtimeWindow = globalThis as unknown as RuntimeWindow;
250
251 if (isTesting) {
252 return;
253 }
254
255 if (runtimeWindow.reactModalInit) {
256 return;
257 }
258
259 modalObject.setAppElement(appElement);
260 // eslint-disable-next-line no-param-reassign
261 modalObject.defaultStyles = defaultStyles || {};
262
263 runtimeWindow.reactModalInit = true;
264};
265
266export const isMobile = (): boolean =>
267 globalThis?.localStorage.mobile || globalThis?.navigator.maxTouchPoints > 1;

Callers 2

ModalFunction · 0.90
PostAppPromptFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected