redux-devtools/packages/redux-devtools-inspector-monitor/demo/src/getOptions.ts
2021-09-25 04:12:30 +00:00

21 lines
521 B
TypeScript

export interface Options {
useExtension: boolean;
supportImmutable: boolean;
theme: string;
dark: boolean;
}
export default function getOptions(location: { search: string }) {
return {
useExtension: location.search.indexOf('ext') !== -1,
supportImmutable: location.search.indexOf('immutable') !== -1,
theme: getTheme(),
dark: location.search.indexOf('dark') !== -1,
};
}
function getTheme() {
const match = /theme=([^&]+)/.exec(location.search);
return match ? match[1] : 'inspector';
}