Skip to content

Commit 5c6667a

Browse files
committed
EN,CZ : pServicePlugin description, tree and files list pdated
1 parent a56f54a commit 5c6667a

File tree

8 files changed

+130
-2
lines changed

8 files changed

+130
-2
lines changed

cs/files.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ resource.md|Zdroj/Balíček
4040
routingmc.md|Směrování kliknutí myši
4141
objDoc.md|Dokumentace objektů
4242
deps.lst.md|Seznam závislostí (deps.lst)
43+
plugLocStrings.md|Lokalizace pluginů
44+
pServicePlugin.md|pServicePlugin

cs/pServicePlugin.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 🔌 pServicePlugin
2+
3+
## Účel pluginu
4+
5+
Tento plugin je určen k definici rozhraní pro rozšiřující služby.
6+
7+
Základem jsou obsluhy napojené na události pluginu 🔌 [pPluginManagement][pPluginManagement].
8+
9+
## Implementace
10+
11+
1. Nový plugin vždy bude mít [pServicePlugin][pServicePlugin] jako svou bázovou třídu.
12+
13+
```javascript
14+
class pNewServicePlugin extends pServicePlugin {
15+
init() {
16+
super.init();
17+
}
18+
19+
_pluginActivated(pluginName, instanceName, instance, storageName) {
20+
if (instance) {
21+
// pokud instance splňuje nějakou podmínku, provést zavedení do seznamu pluginů a další akce
22+
this.addPlugin(pluginName, instanceName);
23+
}
24+
}
25+
26+
_pluginDeactivated(pluginName, instanceName, instance, storageName) {
27+
}
28+
29+
onET...(evt) {
30+
this._doForAllInstances(this._pluginActivated.bind(this));
31+
}
32+
}
33+
34+
Plugins.catalogize(pNewServicePlugin);
35+
```
36+
37+
2. Základní plugin musí definovat vhodné události (včetně jejich obsahu), aby se na jeho procesy bylo možné efektivně napojit.
38+
39+
- _pluginActivated - zajišťuje zpracování pro aktivaci nové instance pluginu
40+
- addPlugin - přidání pluginu a jeho instance do seznamu pluginů, které služba bude spravovat. Musí se volat ručně.
41+
- _pluginDeactivated - zajišťuje zpracování pro odebrání instance pluginu, automaticky provede odebrání instance pluginu ze seznamu pluginů ve službě
42+
- onET...(evt) - služba možná bude potřebovat obsluhu nějaké události, kterou zajišťuje zbytek systému nebo jiný plugin, pro který bude tato služba rozšířením.
43+
- **evt** - bude představovat konkrétní objekt události v závislosti na procesu, který budete vyvíjet
44+
- this._doForAllInstances(this._pluginActivated.bind(this)); - volá metodu _pluginActivated pro všechny evidované instance pluginu. Použití **bind(this)** je nutné, aby se při předání metody **zachoval kontext this**.
45+
46+
## Popis funkčnosti
47+
48+
- Plugin naslouchá událostem ⚡ [PluginActivated][PluginActivated] (volá funkci **\_pluginActivated**) a ⚡ [PluginDeactivated][PluginDeactivated] (volá funkci **\_pluginDeactivated**)
49+
- Plugin naslouchá dalším událostem podle deklarovaných obsluh
50+
- V případě ověření, že instance pluginu splňuje požadavky služby ji zaveďte do seznamu voláním funkce **addPlugin**.
51+
- Odebrání instance se provede automaticky s přijetím ⚡ [PluginDeactivated][PluginDeactivated]
52+
53+
## Příklady implementací
54+
55+
- ⚙️ [pServiceLocalization][pServiceLocalization] a další potomci třídy 🔌 [pServicePlugin][pServicePlugin]
56+
57+
[pPluginManagement]: :_inst:pPluginManagement:.md "pPluginManagement"
58+
[pServiceLocalization]: :_plg:pServiceLocalization.md "pServiceLocalization"
59+
[PluginActivated]: :_evt:PluginActivated.md "PluginActivated"
60+
[PluginDeactivated]: :_evt:PluginDeactivated.md "PluginDeactivated"
61+
[pServicePlugin]: :_plg:pServicePlugin.md "pServicePlugin"

cs/plugLocStrings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Kapitola 🌐 [Nový jazyk prohlížeče][ViewerNewLang] dále popisuje:
2121

2222
## Samostatný lokalizační slovník pro plugin
2323

24-
Pomocí komponenty 🧩 [pServiceLocalization][pServiceLocalization] (součást základního balíčku) lze přidat vlastní lokalizace pro každý plugin. Stačí založit příslušné soubory na správném místě.
24+
Pomocí komponenty 🔌 [pServiceLocalization][pServiceLocalization] (součást základního balíčku) lze přidat vlastní lokalizace pro každý plugin. Stačí založit příslušné soubory na správném místě.
2525

2626
Povinné soubory:
2727

cs/tree.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Implementace pluginů|Implementace pluginů||implPlug.md
2121
🔌 pConvertSysEventToEvent|pConvertSysEventToEvent||pConvertSysEventToEvent.md
2222
🖼️ pTRPhasePlugin|pTRPhasePlugin||pTRPhasePlugin.md
2323
🖼️ pTopicRenderer|pTopicRenderer||pTopicRenderer.md
24+
🔌 pServicePlugin|pServicePlugin||pServicePlugin.md
2425
Definice objektů|Definice objektů||objDef.md
2526
⚙️ Konfigurační volba|Konfigurační volba||cfgopt.md
2627
⚡ Událost|Událost||event.md

en/files.lst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ resource.md|Resource/Package
4040
routingmc.md|Mouse click routing
4141
objDoc.md|Documenting objects
4242
deps.lst.md|List of dependencies (deps.lst)
43+
plugLocStrings.md|Plugin localization
44+
pServicePlugin.md|pServicePlugin

en/pServicePlugin.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 🔌 pServicePlugin
2+
3+
## Purpose of the plugin
4+
5+
This plugin is designed to define interfaces for extension services.
6+
7+
It is based on handlers connected to plugin events 🔌 [pPluginManagement][pPluginManagement].
8+
9+
## Implementation
10+
11+
1. A new plugin will always have [pServicePlugin][pServicePlugin] as its base class.
12+
13+
```javascript
14+
class pNewServicePlugin extends pServicePlugin {
15+
init() {
16+
super.init();
17+
}
18+
19+
_pluginActivated(pluginName, instanceName, instance, storageName) {
20+
if (instance) {
21+
// if the instance meets a condition, add it to the plugin list and perform other actions
22+
this.addPlugin(pluginName, instanceName);
23+
}
24+
}
25+
26+
_pluginDeactivated(pluginName, instanceName, instance, storageName) {
27+
}
28+
29+
onET...(evt) {
30+
this._doForAllInstances(this._pluginActivated.bind(this));
31+
}
32+
}
33+
34+
Plugins.catalogize(pNewServicePlugin);
35+
```
36+
37+
2. The basic plugin must define appropriate events (including their content) so that its processes can be effectively connected.
38+
39+
- _pluginActivated - ensures processing for activating a new plugin instance
40+
- addPlugin - adds a plugin and its instance to the list of plugins that the service will manage. Must be called manually.
41+
- _pluginDeactivated - ensures processing for removing the plugin instance, automatically removes the plugin instance from the list of plugins in the service
42+
- onET...(evt) - the service may need to handle an event provided by the rest of the system or another plugin for which this service will be an extension.
43+
- **evt** - will represent a specific event object depending on the process you are developing
44+
- this._doForAllInstances(this._pluginActivated.bind(this)); - calls the _pluginActivated method for all registered instances of the plugin. The use of **bind(this)** is necessary to **preserve the context of this** when passing the method.
45+
46+
## Functionality description
47+
48+
- The plugin listens for events ⚡ [PluginActivated][PluginActivated] (calls the **\_pluginActivated** function) and ⚡ [PluginDeactivated][PluginDeactivated] (calls the **\_pluginDeactivated** function)
49+
- The plugin listens for other events according to the declared handlers
50+
- If the plugin instance meets the service requirements, add it to the list by calling the **addPlugin** function.
51+
- The instance is removed automatically upon receiving ⚡ [PluginDeactivated][PluginDeactivated]
52+
53+
## Implementation examples
54+
55+
- ⚙️ [pServiceLocalization][pServiceLocalization] and other descendants of the class 🔌 [pServicePlugin][pServicePlugin]
56+
57+
[pPluginManagement]: :_inst:pPluginManagement:.md "pPluginManagement"
58+
[pServiceLocalization]: :_plg:pServiceLocalization.md "pServiceLocalization"
59+
[PluginActivated]: :_evt:PluginActivated.md "PluginActivated"
60+
[PluginDeactivated]: :_evt:PluginDeactivated.md "PluginDeactivated"
61+
[pServicePlugin]: :_plg:pServicePlugin.md "pServicePlugin"

en/plugLocStrings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The chapter 🌐 [New language for Viewer][ViewerNewLang] further describes:
2121

2222
## Separate localization dictionary for the plugin
2323

24-
Using the 🧩 [pServiceLocalization][pServiceLocalization] plugin (part of the basic package), you can add your own localizations for each plugin. Just create the appropriate files in the right place.
24+
Using the 🔌 [pServiceLocalization][pServiceLocalization] plugin (part of the basic package), you can add your own localizations for each plugin. Just create the appropriate files in the right place.
2525

2626
Required files:
2727

en/tree.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Plugin implementation|Plugin implementation||implPlug.md
2121
🔌 pConvertSysEventToEvent|pConvertSysEventToEvent||pConvertSysEventToEvent.md
2222
🖼️ pTRPhasePlugin|pTRPhasePlugin||pTRPhasePlugin.md
2323
🖼️ pTopicRenderer|pTopicRenderer||pTopicRenderer.md
24+
🔌 pServicePlugin|pServicePlugin||pServicePlugin.md
2425
Object definitions|Object definitions||objDef.md
2526
⚙️ Configuration option|Configuration option||cfgopt.md
2627
⚡ Event|Event||event.md

0 commit comments

Comments
 (0)