Skip to content
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

Generators.{now,width} #324

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Generators.{now,width} #324

merged 1 commit into from
Dec 5, 2023

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Dec 5, 2023

This moves now() and width(target?) to Generators.now() and Generators.width(target, options?) in the vanilla standard library. The goal of this change is:

  • Make the difference easier to talk about; are you referring to the built-in width available in Observable Markdown, or the Generators.width available in vanilla JavaScript? If they are both called “width” it’s confusing.
  • Make it possible to use Generators.width in Observable Markdown to observe the width of something else; you can even override the built-in width by saying const width = Generators.width(document.body).
  • Make the target argument mandatory to Generators.width so it’s unambiguous which element you’re observing.

@mbostock mbostock merged commit f8989a6 into main Dec 5, 2023
1 check passed
@mbostock mbostock deleted the mbostock/more-generators branch December 5, 2023 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant