Allow old misspelled option to still work

This commit is contained in:
Jordan Eldredge 2018-04-01 12:12:35 -07:00
parent fc653cfcb2
commit 2d905f55c1
2 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,7 @@
## (next version)
* Deprecated: The misspelled `Winamp` construction option `avaliableSkins` has been deprecated in favor of `availableSkins`. `avaliableSkins` will continue to work, but will log a deprecation warning. [#533](https://github.com/captbaritone/winamp2-js/pull/533) by [@remigallego](https://github.com/remigallego)
## 0.0.6
* Added: `winamp.appendTracks()`.

View file

@ -45,6 +45,7 @@ class Winamp {
this.options = options;
const {
initialTracks,
avaliableSkins, // Old misspelled name
availableSkins,
enableHotkeys = false
} = this.options;
@ -67,11 +68,14 @@ class Winamp {
if (initialTracks) {
this.appendTracks(initialTracks);
}
if (availableSkins) {
this.store.dispatch({
type: SET_AVAILABLE_SKINS,
skins: availableSkins
});
if (avaliableSkins != null) {
console.warn(
"The misspelled option `avaliableSkins` is deprecated. Please use `availableSkins` instead."
);
this.store.dispatch({ type: SET_AVAILABLE_SKINS, skins: avaliableSkins });
} else {
this.store.dispatch({ type: SET_AVAILABLE_SKINS, skins: availableSkins });
}
if (enableHotkeys) {