-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Per https://w3ctag.github.io/design-principles/#casing-rules an IDL dictionary member ends up as fooBar
and an equivalent JSON key as foo_bar
. When an API has both an imperative (IDL) and declarative (JSON) entry point, this can lead to awkward situations, as @saschanaz explains in w3c/push-api#385 (comment):
[T]he callers would have to deal with this casing in that case, like:
onpush = async (ev) => { // Err, our little cute browser doesn't support declarative web push, // so we are here for nice progressive web. const { notification } = await ev.data.json(); // This will mostly work until you use requireInteraction. // await registration.showNotification(notification.title, notification); const notificationOptions = { ...notification, requireInteraction: notification.require_interaction, // 😅 }; await registration.showNotification(notification.title, notificationOptions); };I wonder it would make sense to have an exception here to prevent extra boilerplate and head-scratching?
I'm inclined to accept this inconvenience, but I wonder what other people think. We don't have that much JSON formats in the web platform so we could still change this I suspect.
Related: whatwg/infra#159.
Metadata
Metadata
Assignees
Labels
No labels