From 2d905f55c1fcd122074b198af398397f45dd411e Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 1 Apr 2018 12:12:35 -0700 Subject: [PATCH] Allow old misspelled option to still work --- CHANGELOG.md | 4 ++++ js/winamp.js | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29a34b54..73397bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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()`. diff --git a/js/winamp.js b/js/winamp.js index 45003899..cab45d3c 100644 --- a/js/winamp.js +++ b/js/winamp.js @@ -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) {