Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1852c5e

Browse files
committed
Added deprecation notice and warning
1 parent f13ddae commit 1852c5e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎src/toastify-es.js‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @property {boolean} close - To show the close icon or not
1919
* @property {string} gravity - To show the toast from top or bottom
2020
* @property {string} position - To show the toast on left or right
21-
* @property {string} backgroundColor - Sets the background color of the toast (to be deprecated)
21+
* @property {string} backgroundColor - Deprecated: Sets the background color of the toast
2222
* @property {url} avatar - Image/icon to be shown before text
2323
* @property {string} className - Ability to provide custom class name for further customization
2424
* @property {boolean} stopOnFocus - To stop timer when hovered over the toast (Only if duration is set)
@@ -166,6 +166,12 @@ class Toastify {
166166
escapeMarkup: true,
167167
style: {}
168168
}, options);
169+
170+
if (this.options.backgroundColor) {
171+
// This is being deprecated in favor of using the style HTML DOM property
172+
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
173+
}
174+
169175
this.toastElement = null;
170176

171177
this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : "toastify-top"; // toast position - top or bottom
@@ -194,11 +200,6 @@ class Toastify {
194200

195201
// Assigning gravity of element
196202
divElement.className += ` ${this.options.gravity}`;
197-
198-
if (this.options.backgroundColor) {
199-
// This is being deprecated in favor of using the style HTML DOM property
200-
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
201-
}
202203

203204
// Loop through our style object and apply styles to divElement
204205
for (const property in this.options.style) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /