Skip to content

Instantly share code, notes, and snippets.

View qkreltms's full-sized avatar
๐Ÿ’–
Happy coding

JungHoonPark qkreltms

๐Ÿ’–
Happy coding
View GitHub Profile
export const confirm = (config: ConfirmDialogProps) =>
  factory({ ...config, Component: ConfirmDialog });
export const destroyFns: Array<() => void> = [];

export const destroyAll = () => {
  while (destroyFns.length) {
    const close = destroyFns.pop();
    if (close) {
      close();
    }
 }
export interface ConfirmProps {
  afterClose?: () => void;
  onClickClose?: (
    event: React.MouseEvent<HTMLButtonElement, MouseEvent>
  ) => void;
  onOk?: (
    event:
      | React.MouseEvent<HTMLButtonElement, MouseEvent>
const useModal = (
  isVisible: boolean
): [
  boolean,
  React.Dispatch<React.SetStateAction<boolean>>,
  (event: React.KeyboardEvent<any>) => void
] => {
  const [isOpen, setIsOpen] = useState(isVisible);
interface Factory {
  Component?: any;
  onClosed?: () => void;
  onAfterClosed?: () => void;
  [x: string]: any;
}

export const factory = ({ Component, ...config }: Factory) => {
  const div = document.createElement("div");
   import "bootstrap/dist/css/bootstrap.min.css";
export default function confirm(config: ModalFuncProps) {
  const div = document.createElement('div');
  document.body.appendChild(div);
  // eslint-disable-next-line no-use-before-define
  let currentConfig = { ...config, close, visible: true } as any;

  function render({ okText, cancelText, prefixCls, ...props }: any) {
    /**
 * https://github.com/ant-design/ant-design/issues/23623
const initialState: State = {
  user: {
    id: '',
    nickname: '',
    photoURL: '',
    statusMessage: '',
  },
  deleteMode: false,
  // ref๋ฅผ ์ฃผ์ž…๋ฐ›์„ modal state์ž…๋‹ˆ๋‹ค.
@qkreltms
qkreltms / index.html
Last active October 22, 2020 08:30
my first three js
<head>
<title>threejs - basic setup</title>
</head>
<body>
<canvas id ="c"></canvas>
</body>
์บ์‹œ
์ฐธ๊ณ : https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=ko
1. CDN์—์„œ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ์บ์‹œํ•˜๋Š”๊ฐ€?
api์˜ content-type์— ๋”ฐ๋ผ์„œ (image, pdf, js, css, html ๋“ฑ๋“ฑ...)
์ฃผ์˜: CDN์ด ๋ฐ์ดํ„ฐ๋ฅผ ์บ์‹œํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์›ํ•˜๋Š” ๋•Œ์— ์ตœ์‹ ํ™”๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ค์ง€ ์•Š์˜ฌ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ฃผ์˜๊ฐ€ ํ•„์š”ํ•˜๋‹ค.
2. ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ์บ์‹œ ๋ฐ์ดํ„ฐ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€?
HTTP ํ•ด๋” ์„ค์ • (ETag, Cache-Control)
์ฐธ๊ณ : https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9