انتقل إلى المحتوى الرئيسي

Quick Reference

Essential reference tables and checklists for plugin development.

Plugin Lifecycle Methods

MethodPhasePurpose
onInitialize()StartupRegister listeners, set up monitoring
onActivate()ActivationCreate windows, start services
onDeactivate()DeactivationHide windows, pause services
onDispose()ShutdownRelease all resources

Template Comparison

TemplateBundle SizeBest For
HTML/CSS/JS~60 KBSimple plugins, rapid prototyping
React~200 KBMedium complexity, component reusability
Angular~350 KBComplex applications, enterprise requirements

Download Context Types

TypeUse Case
PluginDownloadContextType.CDNHTTPS ZIP archive from a CDN endpoint
PluginDownloadContextType.LOCALLocal filesystem ZIP (development and enterprise)
PluginDownloadContextType.NPMnpm package registry (public or private)

IPC Channel Naming Convention

All plugin IPC channels should be prefixed with the plugin's unique identifier to prevent collisions:

plugin-name::channel-action

Common IPC Patterns

// Main → Renderer (one-way push)
window.webContents.send("my-plugin::update", data);

// Renderer → Main (fire-and-forget)
ipcRenderer.send("my-plugin::notify", data);

// Renderer → Main (request/response)
const result = await ipcRenderer.invoke("my-plugin::action", data);

// Main process handler
ipcMain.handle("my-plugin::action", async (event, data) => {
return { result: "response" };
});

Distribution Checklist

  • manifest.json present and valid
  • main field references a compiled bundle
  • All IPC handlers removed in onDispose()
  • Settings validated before persistence
  • No raw Node.js APIs exposed to the renderer process
  • contextIsolation enabled and not overridden
  • Build artifacts packaged as build.zip
  • Semantic version follows MAJOR.MINOR.PATCH

Essential Files Reference

FilePurposeRequired
manifest.jsonPlugin identity and entry point declarationYes
index.tsMain process entry pointYes
package.jsonnpm package configurationYes
webpack.config.jsBuild pipeline configurationYes
tsconfig.jsonTypeScript compiler configurationYes
preload.tsMain-to-renderer IPC bridgeIf using a window
ui/index.htmlRenderer process UI documentIf using a window

Additional Resources