Plugin API
English
English
  • Getting Started
    • Introduction
    • Your First Plugin
    • File Structure Overview
    • Plugin Types
      • Window
      • Background Service
      • Format Extension
      • Inspector
    • Debug Plugin
  • Distribution
    • Prepare Plugin
    • Package Plugin
    • Publish Plugin
    • Update Plugin
    • Developer Policies
    • Plugin Icon Template
  • Developer Guide
    • manifest.json Configuration
    • Retrieve Data
    • Modify Data
    • Access Local Files
    • Issue Network Requests
    • Using Node.js Native API
    • Using Third-Party Modules
    • Multilingual (i18n)
    • Frameless Window
  • API Reference
    • event
    • item
    • folder
    • tag
    • tagGroup
    • library
    • window
    • app
    • os
    • screen
    • notification
    • contextMenu
    • dialog
    • clipboard
    • drag
    • shell
    • log
  • Extra Moudle
    • FFmpeg
Powered by GitBook
On this page
  1. Getting Started
  2. Plugin Types

Window

In this article, we will explain the basic concepts of window plugins.

PreviousPlugin TypesNextBackground Service

Last updated 9 months ago

The vast majority of plugins should be developed using this method. It provides a browser window where you can develop the desired features, and this window will automatically pop up when the user clicks on the plugin.

We can set the window properties by setting the main field in the manifest.json file.

{
    "main": {}
}

Set the default open link URL for the window:

{
    "main": {
        "url": "index.html"
    }
}

Set the default width and height of the window:

{
    "main": {
        "url": "index.html",
        "width": 640,
        "height": 480
    }
}

After setting other metadata.json fields, the final code is as follows:

{
    "id": "LBCZE8V6LPCKD",
    "version": "1.0.0",
    "name": "Window Plugin",
    "logo": "/logo.png",
    "keywords": [],
    "main":
    {
        "url": "index.html",
        "width": 640,
        "height": 480
    }
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <script type="text/javascript" src="js/plugin.js"></script>
</head>

<body>
    <div id="message"></div>
</body>
</html>
eagle.onPluginCreate((plugin) => {
    console.log('eagle.onPluginCreate');
    console.log(plugin);
    document.querySelector('#message').innerHTML = `
    <ul>
        <li>id: ${plugin.manifest.id}</li>
        <li>version: ${plugin.manifest.version}</li>
        <li>name: ${plugin.manifest.name}</li>
        <li>logo: ${plugin.manifest.logo}</li>
        <li>path: ${plugin.path}</li>
    </ul>
`;
});

eagle.onPluginShow(() => {
    console.log('eagle.onPluginShow');
});

eagle.onPluginHide(() => {
    console.log('eagle.onPluginHide');
});

eagle.onPluginBeforeExit((event) => {
    console.log('eagle.onPluginBeforeExit');
});

Check out this sample code!

Looking for inspiration? Come and explore our sample code; there's a wealth of exciting content waiting for you!

Sample code for Multilanguage + Multitheme

For developers aiming to achieve multilanguage internationalization (i18n), this GitHub project is your best learning companion! Click the link below to explore how to cleverly combine i18n with multitheme design, adding a touch of magic to your application's multilanguage support.

Note: You can refer to to learn about all the configuration methods for manifest.json

https://github.com/eagle-app/eagle-plugin-examples/tree/main/Window
https://github.com/eagle-app/eagle-plugin-examples/tree/main/i18n+theme
this article