import { OperatingSystem, Platform, PluginMenuItem, SpecialPluginCallback, SpecialPluginCallbackInfo } from '..'; import { CallbackFn, Command_DUPE_2, PowerupCode, RegisterPowerupOptions, WidgetLocation, WidgetOptions } from '../interfaces'; import { RNPlugin } from '../plugin_base'; import { InternalCallMethod, NamespaceBase } from './base'; /** * # Rem Namespace * * The API Rem namespace. Call with `plugin.rem.apiMethodName()`. */ export declare class AppNamespace extends NamespaceBase { private plugin; /** @hidden */ constructor(_call: InternalCallMethod, plugin: RNPlugin); waitForInitialSync: () => Promise; registerPowerup: (args: { name: string; code: PowerupCode; description: string; options: RegisterPowerupOptions; }) => Promise; /** * Register a ***Widget***, which is a custom UI element that you can place into RemNote. */ registerWidget: (fileName: string, location: WidgetLocation, options: WidgetOptions) => Promise; /** * Unregister a ***Widget***. */ unregisterWidget: (fileName: string, location: WidgetLocation) => Promise; /** Register a command in RemNote that triggers your custom logic. * * **Example:** * * ```typescript * plugin.app.registerCommand({ * id: `${this.id}.reminder`, * name: `Remind me in 25min`, * action: () => { * setTimeout(() => this.toast('Reminder is up!'), 2000); * }, * }); * ``` */ registerCommand: (command: Command_DUPE_2) => Promise; /** @hidden */ registerSidebarButton: (command: Command_DUPE_2) => Promise; registerRemMenuItem: (command: Command_DUPE_2) => Promise; registerMenuItem: (menuItem: PluginMenuItem) => Promise; unregisterMenuItem: (id: string) => Promise; /** * Steal keys from the editor. Please see https://github.com/ianstormtaylor/is-hotkey for the syntax for expressing hotkeys. * * NOTE: You must remember to release the stolen keys by calling the `releaseKeys` method. */ stealKeys: (keys: string[]) => Promise; /** * Release stolen keys back to the editor. Please see https://github.com/ianstormtaylor/is-hotkey for the syntax for expressing hotkeys. */ releaseKeys: (keys: string[]) => Promise; /** * Register Custom CSS. * * **Example:** * * ```typescript * const color = ['red', 'green', 'blue'][Math.floor(Math.random() * 3)]; * plugin.app.registerCSS("background", `.rem-text { color: ${color};`); * ``` */ registerCSS: (id: string, css: string) => Promise; /** * Register a status bar item showing infos on the bottom of the screen. * * @hidden */ registerStatusBarItem: (id: string, html: string) => Promise; /** * Get the user's operating system. */ getOperatingSystem: () => Promise; /** * Get the user's platform (app, web) */ getPlatform: () => Promise; /** * Register a function that can be called from within RemNote later */ registerCallback: (callbackId: string, callback: T extends undefined ? CallbackFn : T extends SpecialPluginCallback ? SpecialPluginCallbackInfo[T] : never) => void; /** * Run some code inside a transaction. If the code throws an error, the transaction will be not be saved to disk. Be careful not to hold transactions open for extended periods of time, as this might block other parts of the app. * This is useful for example when imporing a large number of Rem and you want to make sure that if the import fails, no Rems are created. */ transaction: any>(fn: F) => Promise>>; /** Show a toast notification in the top right corner. */ toast: (message: string) => Promise; }