File size: 548 Bytes
66a740c
 
82a88c5
4c98241
e3d3deb
66a740c
 
 
 
 
 
 
4c98241
e3d3deb
c38b220
66a740c
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
export type Config = {
  animate?: boolean;
  smoothScroll?: boolean;
  allowClose?: boolean;
  opacity?: number;
};

let currentConfig: Config = {};

export function configure(config: Config = {}) {
  currentConfig = {
    animate: true,
    allowClose: true,
    opacity: 0.7,
    smoothScroll: false,
    ...config,
  };
}

export function getConfig(): Config;
export function getConfig<K extends keyof Config>(key: K): Config[K];
export function getConfig<K extends keyof Config>(key?: K) {
  return key ? currentConfig[key] : currentConfig;
}