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

Add string constants file #1996

Merged

Conversation

jeremco
Copy link
Contributor

@jeremco jeremco commented Jun 7, 2017

Hi guys,
The goal of this PR is to remove hardcoded strings, and to add constants files.

I have added 3 constants files :

  • streaming/constants/Constants.js for general strings that can be used all over the code
  • streaming/constants/MetricsConstants.js to declare strings relative to metrics (and replace file DashMetricsList).
  • dash/constants/DashConstants.js for strings relative to dash module

The idea is to centralized strings constants, so that they can be easily used and of course modified if needed.

Jérémie


class StringMatcher extends BaseMatcher {
constructor() {
super(
(attr, nodeName) => {
const stringAttrsInElements = {
'MPD': [ 'id', 'profiles' ],
'Period': [ 'id' ],
Copy link
Contributor

Choose a reason for hiding this comment

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

In ES6, these keys can also be replaced with DashConstant constants by wrapping them in [ ]. See https://github.com/Dash-Industry-Forum/dash.js/blob/development/src/streaming/XHRLoader.js#L63 for an example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Meant to comment on the addition rather than the removal but you get the idea ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @bbcrddave for the tip, I didn't know it was possible.
I have made the modification

@jeremco jeremco force-pushed the add_constants_file branch 2 times, most recently from f69c546 to 96e80ef Compare June 9, 2017 09:54
@jeremco jeremco force-pushed the add_constants_file branch 4 times, most recently from f910a40 to 38960fe Compare June 21, 2017 07:13
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.

3 participants