Wiki source code of Front-end macros service API

Last modified by Manuel Leduc on 2026/07/20 10:41

Show last authors
1 == MacrosService ==
2
3 The service handling the registration and delivery of macros.
4
5 {{code language="typescript"}}
6 interface MacrosService {
7 // List all registered macros.
8 list(): MacroWithUnknownParamsType[];
9
10 // Get a macro by its id.
11 get(id: string): MacroWithUnknownParamsType | null;
12 }
13 {{/code}}
14
15 === list() ===
16
17 Returns every registered macro.
18
19 |=Returns|=Description
20 |##MacroWithUnknownParamsType[]##|All registered macros. The returned array is a copy, so mutating it does not affect the service.
21
22 === get(id) ===
23
24 Returns a single macro looked up by its identifier.
25
26 |=Parameter|=Type|=Description
27 |##id##|##string##|The identifier of the macro to retrieve (matched against the macro's ##infos.id##).
28
29 |=Returns|=Description
30 |##MacroWithUnknownParamsType## or ##null##|The registered macro with the provided id, or ##null## when no macro matches.
31
32 === macrosServiceName ===
33
34 A constant string equal to ##"MacrosService"##. Use it as the binding name to resolve the serviceĀ from the Inversify container.
35
36 {{code language="typescript"}}
37 const macrosServiceName: "MacrosService";
38 {{/code}}
39
40 == ComponentInit ==
41
42 Registers the default ##MacrosService## implementation. Instantiating this class with an Inversify container binds ##macrosServiceName## to the default implementation, as the default binding.
43
44 {{code language="typescript"}}
45 class ComponentInit {
46 constructor(container: Container);
47 }
48 {{/code}}
49
50 |=Parameter|=Type|=Description
51 |##container##|##Container##|The Inversify container in which the service is registered.

Get Connected