driver.js / src /config.ts
kamrify's picture
Handle scrollable elements for highlighting
82a88c5
raw
history blame
547 Bytes
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: true,
...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;
}