w3c / deviceorientation

W3C Device Orientation spec
https://www.w3.org/TR/orientation-event/
Other
49 stars 32 forks source link

fire an orientation event need to use the dictionary #184

Open marcoscaceres opened 1 month ago

marcoscaceres commented 1 month ago

In "fire an orientation event", it reads:

Fire an event named event at window, using DeviceOrientationEvent, with the alpha attribute initialized to z, the beta attribute initialized to x, the gamma attribute initialized to y, and the absolute attribute initialized to absolute.

However, the event needs to be initialized with DeviceOrientationEventInit instead.

reillyeon commented 3 weeks ago

Are there any canonical examples (e.g. in the WebIDL or Infra specs) for the correct incantation for initializing a new instance of an interface? I feel like I've seen a number of different styles over the years. Your comment that "the event needs to be initialized with DeviceOrientationEventInit instead" implies that the steps should be something like:

  1. Let eventInit be «[ "alpha" → z, "beta" → x, "gamma" → y, "absolute" → absolute ]».
  2. Let event be a new DeviceOrientationEvent using eventInit.
  3. Fire an event named event at window, using event.