Permalink
Browse files

refactor: player.usingNativeControls() (#4749)

  • Loading branch information...
kocoten1992 authored and gkatsev committed Nov 16, 2017
1 parent 79b4355 commit eb909f0b34cea7ca6cf0868a29c59541f375551a
Showing with 30 additions and 27 deletions.
  1. +30 −27 src/js/player.js
View
@@ -2711,37 +2711,40 @@ class Player extends Component {
* The current value of native controls when getting
*/
usingNativeControls(bool) {
if (bool !== undefined) {
bool = !!bool;
// Don't trigger a change event unless it actually changed
if (this.usingNativeControls_ !== bool) {
this.usingNativeControls_ = bool;
if (bool) {
this.addClass('vjs-using-native-controls');
if (bool === undefined) {
return !!this.usingNativeControls_;
}
/**
* player is using the native device controls
*
* @event Player#usingnativecontrols
* @type {EventTarget~Event}
*/
this.trigger('usingnativecontrols');
} else {
this.removeClass('vjs-using-native-controls');
bool = !!bool;
/**
* player is using the custom HTML controls
*
* @event Player#usingcustomcontrols
* @type {EventTarget~Event}
*/
this.trigger('usingcustomcontrols');
}
}
// Don't trigger a change event unless it actually changed
if (this.usingNativeControls_ === bool) {
return;
}
return !!this.usingNativeControls_;
this.usingNativeControls_ = bool;
if (this.usingNativeControls_) {
this.addClass('vjs-using-native-controls');
/**
* player is using the native device controls
*
* @event Player#usingnativecontrols
* @type {EventTarget~Event}
*/
this.trigger('usingnativecontrols');
} else {
this.removeClass('vjs-using-native-controls');
/**
* player is using the custom HTML controls
*
* @event Player#usingcustomcontrols
* @type {EventTarget~Event}
*/
this.trigger('usingcustomcontrols');
}
}
/**

0 comments on commit eb909f0

Please sign in to comment.