Skip to content

[css-view-transitions] Making the callback param non-nullable #9460

In css-view-transitions, we define the following, an optional nullable callback with the default value of null:

partial interface Document {
  ViewTransition startViewTransition(optional UpdateCallback? updateCallback = null);
};

In #8960 we resolved to change the callback (in Level 2) to take either a callback or a dictionary of options. Naively, this would have been the following

ViewTransition startViewtransition(optional (UpdateCallback or Dictionary)? param = null)

But that's not possible because of the following restriction:

A nullable type is an IDL type constructed from an existing type (called the inner type) [...] The inner type must not be:

A simple solution is to just make these non-nullable:

ViewTransition startViewtransition(optional (UpdateCallback or Dictionary) param)

Additionally, for consistency, it would be nice to make the existing view transition callback non nullable as well, while still remaining optional:

ViewTransition startViewtransition(optional UpdateCallback updateCallback)

I believe the only script visible change here is that this would preclude startViewTransition(null) from being valid. I could be wrong though. If I'm right, then I think that's fine, since that doesn't seem like a correct use of this API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant