Skip to content

Universal DevTools Kit SDK


Universal DevTools Kit SDK / @u-devtools/core / ClientApi

Interface: ClientApi ​

Defined in: index.ts:305

Client API - Main API object provided to plugins in Client context. Provides access to all DevTools services: RPC, storage, settings, notifications, etc.

Available in: Client context (Vue 3 iframe)

Example ​

typescript
import type { PluginClientInstance } from '@u-devtools/core';

const plugin: PluginClientInstance = {
  name: 'My Plugin',
  icon: 'Cube',

  renderMain(container, api) {
    // Use api.storage for plugin state
    api.storage.set('lastView', 'list');
    const lastView = api.storage.get('lastView', 'default');

    // Use api.settings for user preferences
    api.settings.set('fontSize', 16);
    const fontSize = api.settings.get('fontSize', 14);

    // Navigation
    api.navigation.openPlugin('other-plugin');

    // Event bus
    api.bus.on('other-plugin:event', (data) => {
      console.log('Received event:', data);
    });
    api.bus.emit('my-plugin:event', { data: 'value' });

    // Async operations (use async IIFE for await)
    (async () => {
      // Use api.rpc to call server methods
      const data = await api.rpc.call('my-plugin:getData');

      // Notifications
      api.notify('Data saved successfully', 'success');

      // Clipboard
      await api.clipboard.copy('text to copy');

      // Dialog
      const confirmed = await api.dialog.confirm({
        title: 'Confirm',
        message: 'Are you sure?',
      });
    })();

    return () => {}; // Cleanup function
  }
};

Properties ​

bus ​

bus: EventBusApi

Defined in: index.ts:319

Event bus for plugin-to-plugin communication


clipboard ​

clipboard: ClipboardApi

Defined in: index.ts:317

Clipboard operations API


dialog ​

dialog: DialogApi

Defined in: index.ts:321

Dialog API for confirmations and prompts


navigation: NavigationApi

Defined in: index.ts:323

Navigation API for switching between plugins


notify() ​

notify: (msg, type?) => void

Defined in: index.ts:309

Show a notification to the user

Parameters ​

ParameterType
msgstring
type?"success" | "error" | "info"

Returns ​

void


rpc ​

rpc: RpcClientInterface

Defined in: index.ts:307

RPC client for calling server methods


settings ​

settings: SettingsApi

Defined in: index.ts:313

Settings API for user-configurable preferences (e.g., font size, theme)


shortcuts ​

shortcuts: ShortcutApi

Defined in: index.ts:315

Keyboard shortcuts API


storage ​

storage: StorageApi

Defined in: index.ts:311

Storage API for plugin-specific persistent state (e.g., last opened file)

Released under the MIT License.