How to call two parameter key events in javascript?

I’m wanting to use, in Javascript, some of the two parameter electrical key
events, such as ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE. This key event
requires a bus index and a source index. For using the simvars that require
the same, I’m successful with doing such like the below:
SimVar.SetSimVarValue(“BUS LOOKUP INDEX”, “Number”, 2) .then(() => { let
my_var = SimVar.GetSimVarValue(“BUS CONNECTION ON:6”, “Bool”); }) But using
the same approach for key events doesn’t seem to be successful. What method
would I use in those cases?

If using the avionics framework you can use KeyEventManager.triggerKey[1], or
else you can see the Coherent event it uses to trigger key events[2]. [1]
<https://microsoft.github.io/msfs-avionics-
mirror/docs/framework/classes/index.KeyEventManager/#triggerkey> [2]
<https://github.com/microsoft/msfs-avionics-
mirror/blob/90ade0e3cd789fd6aeef18e5bc233ef30774ffe3/src/sdk/data/KeyEventManager.ts#L72>