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

Refresh DataTransfer API #763

Merged
merged 10 commits into from
Feb 10, 2023
Merged

Conversation

zetashift
Copy link
Contributor

Should resolve #738

@zetashift zetashift changed the title Refresh DataTransfer api Refresh DataTransfer API Jan 30, 2023
/** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be
* provided also.
*/
def add(data: File): Unit = js.native
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDN says this has a defined return value :)

A DataTransferItem containing the specified data. If the drag item couldn't be created (for example, if the associated DataTransfer object has no data store), null is returned.

https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList/add#return_value

Comment on lines 1300 to 1301
DataTransfer[JT] var dropEffect: DropEffectValue
DataTransfer[JT] var effectAllowed: EffectAllowedValue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, after many sleepless nights I propose:

  • DataTransferDropEffectKind
  • DataTransferEffectAllowedKind

Rationale:

  • Prefix with DataTransfer to "namespace" them. Since we are just making these names up, there's no guarantee that there won't be some other unrelated DropEffect or EffectAllowed API added in the future, that would clash with the name.
  • Postfix with Kind, because the spec describes it as "the kind of operation". Furthermore, looking through other enums we've facaded, we have various "kinds" but not any "values".

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix to namespace sounds extremely meh, but I can't argue with that reasoning :P.
And yes postfixing with Kind sounds great!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix to namespace sounds extremely me

Heh yeah, welcome to browsers where everything is in the global namespace 😛 anyway we have various precedents for doing that as well, some of which I think has been copied from spec/TS/something 🤔

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! This was a big one.

@armanbilge armanbilge merged commit 4ee8bbc into scala-js:main Feb 10, 2023
@zetashift zetashift deleted the refresh-datatransfer-api branch February 20, 2023 01:00
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.

Refresh DataTransfer API
2 participants