Plugin: CodeScript Toolkit

That is actually the command in my sample script that I show AI bots along with the prompt to ask for a new script:

import { App, Plugin } from 'obsidian';

const reloadActivePage = async (app: App): Promise<void> => {
    app.workspace.activeLeaf?.rebuildView();
};

export class ReloadPagePlugin extends Plugin {
    async onload() {
        this.addCommand({
            id: 'reload-page',
            name: 'Reload page',
            callback: () => reloadActivePage(this.app)
        });
    }
}

export async function invoke(app: App): Promise<void> {
    return reloadActivePage(app);
}
2 Likes