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

fix: expose tech but warn without safety var #3916

Merged
merged 5 commits into from
Jan 18, 2017

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Jan 4, 2017

No description provided.

@gkatsev gkatsev added the major label Jan 4, 2017
@gkatsev
Copy link
Member Author

gkatsev commented Jan 4, 2017

The tests need to be updated.

throw new Error(errorText);
if (!safety) {
const warnText = `
Using the tech directly can be dangerous. I hope you know what you're doing.
Copy link
Member

Choose a reason for hiding this comment

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

ha!

@dmlap
Copy link
Member

dmlap commented Jan 4, 2017

LGTM

See https://github.com/videojs/video.js/issues/2617 for more info.
`;

log.warn(warnText);
Copy link
Member

Choose a reason for hiding this comment

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

The variable seems superfluous. Is there a reason not to pass a string directly to warn()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope.

throw new Error(errorText);
if (!safety) {
log.warn(`
Using the tech directly can be dangerous. I hope you know what you're doing.
Copy link
Contributor

Choose a reason for hiding this comment

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

won't this add lots of whitespace to the start of the warning?

* @param {boolean} safety.IWillNotUseThisInPlugins
* Must be set to true or else this function will throw an error.
* @param {Any} safety
* Anything passed in to silence the warning
Copy link
Contributor

Choose a reason for hiding this comment

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

technically it will have to be a true value, due to the if check (we may want to check if it is === undefined below)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, updated.

*
* @param {boolean} safety.IWillNotUseThisInPlugins
* Must be set to true or else this function will throw an error.
* @param {Any} safety
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

changed it to * and also made it optional via [safety].

@gkatsev gkatsev merged commit 8622b26 into videojs:master Jan 18, 2017
@gkatsev gkatsev deleted the easier-tech-get branch January 18, 2017 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants