For the complete documentation index, see llms.txt. This page is also available as Markdown.

Background Service

This article will describe the basic concepts of background service plugins.

The development of background service plugins is similar to window plugins, with the main difference being the timing of code execution. Background service plugins will automatically start when the software starts, while window plugins will only execute when the user clicks on them. To create a background service plugin, simply add "serviceMode": true to the main field in the manifest.json, as shown below:

{
    "main":
    {
        "serviceMode": true,    // main difference
        "url": "index.html",
        "width": 640,
        "height": 480
    }
}

Background service plugins can also pop up windows, in which you can display the progress and status of the current background task, allowing users to clearly understand the current state of the plugin.

The final code is as follows:

{
    "id": "LBCZEHP8BBO94",
    "version": "1.0.0",
    "name": "Service Plugin",
    "logo": "/logo.png",
    "keywords": [],
    "main":
    {
        "serviceMode": true,
        "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>Background services can be without UI, but you can still display the status of background services here.</div>
</body>
</html>

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

Last updated