Update readme.md
This commit is contained in:
parent
e0fea221d0
commit
966ddbaf80
27
readme.md
27
readme.md
|
@ -23,6 +23,12 @@ Plugins have to be installed in the following fashion:
|
|||
|
||||
Every plugin is its own folder, **named with the plugin's id** defined in the **plugin.json** file.
|
||||
|
||||
## Backend and frontend
|
||||
L'Math consists of two parts: the node.js backend and the Electron frontend.
|
||||
Even though L'Math isn't sandboxed and node.js integration is allowed on the frontend,
|
||||
it is highly recommended to use the messaging channel provided by the plugin API.
|
||||
The plugin api uses the ipc messaging channel, and its sole purpose is to enable communicate between the two processes.
|
||||
|
||||
## plugin.json
|
||||
The **plugin.json** file is the **metadata file**.
|
||||
The main purpose of the file is to act as an information source.
|
||||
|
@ -55,12 +61,21 @@ L'Math reads and interprets plugin.json files in its own way.
|
|||
The `id` field **has to equal to the folder name**, otherwise the plugin will not be loaded.
|
||||
If the plugin.json file doesn't exist, the folder will be ignored.
|
||||
|
||||
## Backend and frontend
|
||||
L'Math consists of two parts: the node.js backend and the Electron frontend.
|
||||
Even though L'Math isn't sandboxed and node.js integration is allowed on the frontend,
|
||||
it is highly recommended to use the messaging channel provided by the plugin API.
|
||||
The plugin api uses the ipc messaging channel, and its sole purpose is to enable communicate between the two processes.
|
||||
There is an array named `modules` in the metadata file.
|
||||
It basically lists all JS files that should be loaded and where to load them.
|
||||
If a module should be loaded on the backend side, its `type` field should equal to `backend`,
|
||||
and similarly `frontend` for every frontend module.
|
||||
|
||||
## The plugin API
|
||||
## Plugin modules
|
||||
As stated at the metadata file section, in order to actually get anything done, a plugin should have loadable modules.
|
||||
These modules will be loaded using a standard `require` call, and have to have an `init` method.
|
||||
Some useful arguments are passed to the `init` methods. To learn more, see [the plugin page](docs/plugin.md).
|
||||
|
||||
Plugins can interact with the program using a set of revealed objects.
|
||||
The frontend side gets the `window` object and an API object.
|
||||
Similarly the backend side gets a logger object and an API object.
|
||||
More about the API object down below.
|
||||
|
||||
## The plugin API objects
|
||||
Horribly bad documentation is available [here](docs/api.md).
|
||||
Feel free to take a look at the [example plugin](example/).
|
||||
|
|
Loading…
Reference in New Issue
Block a user