1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use *;
/// Declare an action, this is a component that also
/// defines a relation between actions and the singleton observer.
///
/// This may be deprecated once we get many-many relations
/// Add observers to a global action observer entity.
/// This macro must be placed above `#[derive(Component)]` as it
/// sets the `on_add` and `on_remove` hooks.
/// ## Example
/// ```rust ignore
/// #[action(log_on_run)]
/// #[derive(Component)]
/// struct LogOnRun(pub String);
///
/// fn log_on_run(trigger: Trigger<OnRun>, query: Populated<&LogOnRun>) {
/// let name = query.get(trigger.action).unwrap();
/// println!("log_name_on_run: {}", name.0);
/// }
/// ```