Sending sim events from toolbar panel

Is it possible to send sim events from JS code in a toolbar panel? Some things
(eg: setting sim rate) cannot be done by changing sim vars. Any help much
appreciated!

Adding

Should allow you to send the K events for SimRate increase and decrease like

SimVar.SetSimVarValue("K:SIM_RATE_INCR", "number", 0);
SimVar.SetSimVarValue("K:SIM_RATE_DECR", "number", 0);

p.s. the value doesn’t matter, because the k event takes no parameter afaik

Does that works for custom events too ? Provided we have a client that
responds to custom events via Simconnect, will something like this work ?

SimVar.SetSimVarValue("K:Custom.Event", "number", 0);

Thanks! Sorry for such a newbie question, but is there a list of these K
events? And are there other letters?

You can find most of them in the docs
https://docs.flightsimulator.com/html/index.htm#t=Programming_Tools%2FSimVars%2FEvent_IDs.htm
and
https://docs.flightsimulator.com/html/index.htm#t=Programming_Tools%2FSimConnect%2FStatus%2FStatus_Of_SimEvents.htm
Just omit the “KEY_” portion of it in your call.

Is this really enough? I am trying in my custom html, which comes from my web
server, to set the nav radio frequency.

SimVar.SetSimVarValue("NAV1_RADIO_SET_HZ", "uint", parseInt("116700000"));

Edit: It works with

SimVar.SetSimVarValue("NAV1_RADIO_SET_HZ", "number, parseInt("116700000"));

I had to add a message liestener in the panel.js and send messagePost from my
iframe. How can I write to the developer console with javascript?