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

Function initReactModal

packages/shared/src/lib/func.ts:225–252  ·  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

223};
224
225export const initReactModal = ({
226 modalObject,
227 appElement,
228 defaultStyles,
229}: {
230 modalObject: {
231 setAppElement: (element: string | HTMLElement) => void;
232 defaultStyles: ReactModal.Styles;
233 };
234 appElement: string | HTMLElement;
235 defaultStyles?: ReactModal.Styles;
236}): void => {
237 const runtimeWindow = globalThis as unknown as RuntimeWindow;
238
239 if (isTesting) {
240 return;
241 }
242
243 if (runtimeWindow.reactModalInit) {
244 return;
245 }
246
247 modalObject.setAppElement(appElement);
248 // eslint-disable-next-line no-param-reassign
249 modalObject.defaultStyles = defaultStyles || {};
250
251 runtimeWindow.reactModalInit = true;
252};
253
254export const isMobile = (): boolean =>
255 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