react-youtube-playlist
Version:
A react component for displaying the contents of a user's YouTube playlist.
66 lines (49 loc) • 1.98 kB
JavaScript
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import _typeof from 'babel-runtime/helpers/typeof';
import warning from 'warning';
var warned = {};
function deprecationWarning(oldname, newname, link) {
var message = void 0;
if ((typeof oldname === 'undefined' ? 'undefined' : _typeof(oldname)) === 'object') {
message = oldname.message;
} else {
message = oldname + ' is deprecated. Use ' + newname + ' instead.';
if (link) {
message += '\nYou can read more about it at ' + link;
}
}
if (warned[message]) {
return;
}
process.env.NODE_ENV !== 'production' ? warning(false, message) : void 0;
warned[message] = true;
}
deprecationWarning.wrapper = function (Component) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return function (_Component) {
_inherits(DeprecatedComponent, _Component);
function DeprecatedComponent() {
_classCallCheck(this, DeprecatedComponent);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
DeprecatedComponent.prototype.componentWillMount = function componentWillMount() {
deprecationWarning.apply(undefined, args);
if (_Component.prototype.componentWillMount) {
var _Component$prototype$;
for (var _len2 = arguments.length, methodArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
methodArgs[_key2] = arguments[_key2];
}
(_Component$prototype$ = _Component.prototype.componentWillMount).call.apply(_Component$prototype$, [this].concat(methodArgs));
}
};
return DeprecatedComponent;
}(Component);
};
export default deprecationWarning;
export function _resetWarned() {
warned = {};
}