-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[scroll-animations-1] Animation.getCurrentTime is easily confused with Animation.currentTime #8201
Comments
|
I don't think we shouldn't do that. We'll confuse authors unnecessarily. We can't deprecate For users that need a time for a range, there's |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> s/Topic/Subtopic/<TabAtkins> flackr: Bikeshedding issue <TabAtkins> flackr: we added an API to get a range-specific current time <TabAtkins> flackr: But Brian brought up that when you're not specifying a range, and just getting the time of the timeline, there's already an accessor for that <TabAtkins> flackr: So q is, should this get a range-specific name, or just consider the .currentTime accessor legacy? <TabAtkins> flackr: Because one bit about the function is we can return the TypedOM object, rather than just the double that .currentTime returns <TabAtkins> flackr: I'm slightly in preference to this being the new way to get times, so use a generic name, and have range name specified in options with a property bag as Brian suggested <TabAtkins> astearns: But Brian thinks we shoudl go with getCurrentTimeForRange()? <TabAtkins> flackr: Yeah, Brian thinks it's confusing to have another API for something we already have an accessor for <astearns> ack fantasai <TabAtkins> flackr: I'm not concerned with calling it getCurrenTtimeForRange(), just need to decide <TabAtkins> fantasai: My thoughts are we'd add this to get the TypedOM object, and to get it relative to a range. <TabAtkins> fantasai: Feel like taking a property bag is a little awkward from a usage pov <TabAtkins> fantasai: I think ranges are a fundamental enough concept that having it just be a string argument is fine <TabAtkins> flackr: His argument for a property bag is that we dont' want to confused authors, and might want to extend in the future <TabAtkins> fantasai: Those can go in a property bag <TabAtkins> astearns: I'm a little concerned with resolving without Brian's okay <TabAtkins> flackr: Least contentious is to resolve on the ForRange naming, we know Brian is okay with that <TabAtkins> astearns: fantasai, you okay with ForRange? <TabAtkins> fantasai: Think it depends on if we want a plain getCurrentTime at any point <TabAtkins> fantasai: Coujld push to apac call and get Brian on <fantasai> TabAtkins: I'm mildly against extremely long names, especially if the arg is obvious, extra typing is annoying <fantasai> TabAtkins: not strongly for/against property bag vs positional argument, but lean towards positional b/c fantasai's arg that it's quite fundamental <fantasai> TabAtkins: if we put in property bag, we can make an overload later <fantasai> TabAtkins: for API niceness, I think I like what I believe the spec currently specifies <fantasai> TabAtkins: getCurrentTime("rangename") <fantasai> TabAtkins: can add property bag later <fantasai> flackr: Should we resolve this is what we prefer and ask Brian to take a look? <TabAtkins> astearns: So proposed reoslution is to use the short name with a string argument, reasons above, ping Brian to see if he wants to object <TabAtkins> astearns: objections? <TabAtkins> RESOLVED: Pending Brian's potential objections, go with `getCurrentTime(rangeName?)` <bramus> 8192? |
I'm afraid I'm still opposed to the current naming. I don't think ranges are a fundamental concept. The overwhelming majority usage of the API will continue to be for time-based animations and I think we should bias towards that.
If we must have
Now that TS/JS language servers are able to automatically refactor positional arguments into property bags, property bags have become much more common so I believe this approach is also idiomatic. |
After playing with the API a bit, I follow what Brian is saying and think An alternative name that came up was Also fine with the property bag approach. To be clear, that would then, for example, be |
Per the TAG Design Principles, optional and/or primitive arguments should be accepted through dictionaries, not positional arguments. |
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> astearns: Previously decided on using getCurrentTime() with a position param<TabAtkins> astearns: Comments since have noted that the tag prefers property bags <TabAtkins> astearns: And the person who objects to the name would be okay with property bag instead of positional arg <TabAtkins> astearns: So proposal is to change the previous resolution to use a property bag instead <TabAtkins> astearns: Comments? <TabAtkins> `getCurrentTime({ range: "cover" })` looks fine to me <TabAtkins> astearns: Objections? <TabAtkins> RESOLVED: Change getCurrentTime() parameter to a dict to satisfy Brian's/the TAG's concerns. |
Let me know if this requires a separate issue, but I was surprised to see that |
Scroll timelines don't produce millisecond-based times, so we decided that we should future proof APIs with a CSSNumericValue which can represent the difference between milliseconds and percentages. We should still apply the same clamping to those millisecond values in the CSSNumericValue as we do for DOMHighResTimestamp. |
I believe this issue has been addressed, but there's some follow-up concerns in #8765 |
I think it's confusing to have both
currentTime
andgetCurrentTime
.Would it be possible to:
Move this to the(Update: I see now that this is proposed to be used forScrollTimeline
interface,DocumentTimeline
too--I still don't quite follow the use cases but assuming we want to do that, I guess it should stay onAnimationTimeline
)getCurrentTimeForRange
, andrangeName
argument non-optional?
The text was updated successfully, but these errors were encountered: