Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Return enums instead of strings in Jason's exported functions #146

Merged
merged 2 commits into from
Oct 9, 2020

Conversation

alexlapa
Copy link
Collaborator

@alexlapa alexlapa commented Oct 8, 2020

Synopsis

Как-то так повелось, что enum'ы в js'ку мы возвращаем в виде строк, так как решили что для js'ки так будет более идиоматично. При этом в функциях которые принимают enum'ы, мы принимаем enum'ы. Хочется достичь консистентности: мы или и принимаем и возвращаем enum'ы, или мы и принимаем и возвращаем стринги.

Склоняюсь к первому варианту.

Solution

  1. Expose MediaKind and MediaSourceKind enums.
  2. Change some exported functions return types:
    InputDeviceInfo.kind -> String => InputDeviceInfo.kind -> MediaKind
    MediaTrack.kind -> String => MediaTrack.kind -> MediaKind
    MediaTrack.media_source_kind -> String => MediaTrack.media_source_kind -> MediaSourceKind
  3. Internally we use 3 enums with Audio and Video variants: InputDeviceKind, TransceiverKind and MediaTrackKind. Get rid of those in favor of MediaKind enum.

Checklist

  • Created PR:
    • In draft mode
    • Name contains Draft: prefix
    • Name contains issue reference
    • Has k:: labels applied
    • Has assignee
  • Documentation is updated (if required)
  • Tests are updated (if required)
  • Changes conform code style
  • CHANGELOG entry is added (if required)
  • FCM (final commit message) is posted
    • and approved
  • Review is completed and changes are approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • Draft: prefix is removed
    • All temporary labels are removed

@alexlapa alexlapa added enhancement Improvement of existing features or bugfix k::refactor Refactoring, technical debt elimination and other improvements of existing code base labels Oct 8, 2020
@alexlapa alexlapa added this to the 0.2.0 milestone Oct 8, 2020
@alexlapa alexlapa self-assigned this Oct 8, 2020
@alexlapa alexlapa changed the title Draft: Jason: Return enums in exported function instead of strings Draft: Return enums instead of strings in Jason's exported functions Oct 8, 2020
@alexlapa
Copy link
Collaborator Author

alexlapa commented Oct 8, 2020

Return enums instead of strings in Jason's exported functions (#146)

- export MediaKind and MediaSourceKind enums to JS
- InputDeviceInfo::kind now returns MediaKind instead of String
- MediaTrack::kind now returns MediaKind instead of String
- MediaTrack::media_source_kind now returns MediaSourceKind instead of String

@alexlapa alexlapa marked this pull request as ready for review October 8, 2020 10:09
@alexlapa alexlapa requested a review from tyranron October 8, 2020 10:09
@tyranron tyranron changed the title Draft: Return enums instead of strings in Jason's exported functions Return enums instead of strings in Jason's exported functions Oct 9, 2020
@alexlapa alexlapa merged commit fef858e into master Oct 9, 2020
@alexlapa alexlapa deleted the jason-enums-instead-of-strings branch October 9, 2020 22:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement of existing features or bugfix k::refactor Refactoring, technical debt elimination and other improvements of existing code base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants