Document all known values for things like IKeyboardEvent.type:string

It is a string and it is hard to know what all the possible values are for it from just the API docs, but I wonder if it would be (crazy but) possible to eg programmatically find all the uses in the source code and update the docs with a list of them, or link to a list of them.

curiously there are things like KeyboardEventTypes | Babylon.js Documentation which makes me wonder if the source code could/should be changed so that the static type of IKeyboardEvent.type is not just a bare string, but a properly constrained KeyboardEventType?

oh those aren’t at the same level of abstraction, one is at the Info level, the other at the Info.Event level… kinda confusing… oh well heh. Would still be super cool if the Info.Event.type:string api docs said what the possible strings were somehow.

Interacting With Scenes | Babylon.js Documentation says " By customizing the following code template you can control reactions within your scene to different keys. Both the ascii code for the key and the key itself are available to you." which is almost helpful… it would be super great if there were a link to documentation about the possible values for those!

Adding @RaananW to see if he can think of something else than manually documenting it

This helped me although the wording is still confusing…

BabylonJS documentation could perhaps say
“event.key → link to MDN for that”
“event.keyCode → link to MDN for that” and warn do not use, prefer:
“event.code → link to MDN for that”

HOWEVER what i worry about next is how does this work for e.g. “native” Babylon?! :slight_smile:


I am a bit confused as to the actual issue here.

You are linking to event.type , which is the native event type (Event.type - Web APIs | MDN), but later talk about key, keyCode and code.

I assume you are talking about this entire class and what the entire meaning of the event datatypes.
This interface is meant to unify the event interface between browser(core) babylon implementation and native implementation, which doesn’t have the full concept of browser events. It’s a direct copy of Event - Web APIs | MDN and copies from the source event as much as it can. Babylon native might not populate the entire event (the required fields will always be supported). @bghgary can help explaining how babylon native deals with that.

I do agree it could have been better documented though :slight_smile: This is an Event interface without using the DOM typescript lib. That’s about it, in general.


@PolygonalSun and @sebavan will be working on the input work soon but we haven’t really nailed this down yet for Babylon Native. +1 on more documentation.