feat/devtool
dominikg 4 months ago
parent d330a30349
commit 4427a98706

@ -10,15 +10,16 @@ const config = {
* @param {Partial<import('./public.d.ts').Config>} options
*/
export function configure(options) {
for (const [key, value] of options) {
for (const [key, value] of Object.entries(options)) {
if (key === 'tools') {
for (let tool of /** @type {import('./public.d.ts').Config.tools[0][]}*/ value) {
if(typeof tool === 'function') {
tool = tool();
tool = tool(); // TODO lazy init?
}
/** @type {import('./public.d.ts').Tool}*/
const existing = config.tools.find((t) => t.name === tool.name);
if (existing) {
for (const [k, v] of tool) {
for (const [k, v] of Object.entries(tool)) {
existing[k] = v;
}
} else {

@ -3,8 +3,8 @@ export * from './index.js';
export interface Tool {
name: string;
icon: string; // url or svg
activate();
deactivate();
activate:()=>void;
deactivate:()=>void;
keyCombo?: string;
disabled?: boolean;
}

Loading…
Cancel
Save