DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/Binary/Build/PostHogPlugin/
CaptureEvent.rs1use crate::Binary::Build::PostHogPlugin::{CaptureAllowed, Client, DistinctId};
6
7pub fn Fn(EventName:&str, Properties:Option<Vec<(&str, &str)>>) {
8 if !CaptureAllowed::Fn() {
9 return;
10 }
11
12 let Some(C) = Client::CLIENT.get() else { return };
13
14 let mut Event = posthog_rs::Event::new(EventName, &DistinctId::Fn());
15
16 let _ = Event.insert_prop("$app", "fiddee");
17
18 let _ = Event.insert_prop("$app_version", "0.0.1");
19
20 let _ = Event.insert_prop("$build_mode", "debug");
21
22 let _ = Event.insert_prop("$component", "mountain");
23
24 if let Some(Props) = Properties {
25 for (Key, Value) in Props {
26 let _ = Event.insert_prop(Key, Value);
27 }
28 }
29
30 let _ = C.capture(Event);
31}