allow Tool to be function

feat/devtool
dominikg 4 months ago
parent baf1dd1e7f
commit d330a30349

@ -12,7 +12,10 @@ const config = {
export function configure(options) {
for (const [key, value] of options) {
if (key === 'tools') {
for (const tool of /** @type {import('./public.d.ts').Tool[]}*/ value) {
for (let tool of /** @type {import('./public.d.ts').Config.tools[0][]}*/ value) {
if(typeof tool === 'function') {
tool = tool();
}
const existing = config.tools.find((t) => t.name === tool.name);
if (existing) {
for (const [k, v] of tool) {

@ -8,7 +8,9 @@ export interface Tool {
keyCombo?: string;
disabled?: boolean;
}
type ToolFn = ()=>Tool
export interface Config {
position?: 'top' | 'bottom';
tools?: Tool[];
tools?: (Tool | ToolFn)[];
}

Loading…
Cancel
Save