-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha!
LGTM |
See https://github.com/videojs/video.js/issues/2617 for more info. | ||
`; | ||
|
||
log.warn(warnText); |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the type here should actually be *
. https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#the-all-type
There was a problem hiding this comment.
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]
.
No description provided.