Skip to content

Commit

Permalink
Update defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
apvarun committed Apr 25, 2021
1 parent fd5f520 commit ae5bae8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
47 changes: 24 additions & 23 deletions src/toastify-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@

class Toastify {

defaults = {
oldestFirst: true,
text: "Toastify is awesome!",
node: undefined,
duration: 3000,
selector: undefined,
callback: function() {},
destination: undefined,
newWindow: false,
close: false,
gravity: "toastify-top",
positionLeft: false,
position: "",
backgroundColor: "",
avatar: "",
className: "",
stopOnFocus: true,
onClick: function() {},
offset: { x: 0, y: 0 },
escapeMarkup: true,
style: { background: "" },
};

constructor(options) {
/**
* The version of Toastify
Expand Down Expand Up @@ -143,29 +166,7 @@ class Toastify {
_init(options) {

// Setting defaults
this.options = Object.assign({
text: "Hi there!",
node: undefined,
duration: 3000,
selector: undefined,
callback: function() {},
destination: undefined,
newWindow: false,
close: false,
gravity: "toastify-top",
position: "right",
backgroundColor: undefined,
avatar: "",
className: "",
stopOnFocus: undefined,
onClick: undefined,
offset: {
x: 0,
y: 0
},
escapeMarkup: true,
style: {}
}, options);
this.options = Object.assign(this.defaults, options);

if (this.options.backgroundColor) {
// This is being deprecated in favor of using the style HTML DOM property
Expand Down
8 changes: 4 additions & 4 deletions src/toastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

// Set the default global options
Toastify.defaults = {
oldestFirst: false,
oldestFirst: true,
text: "Toastify is awesome!",
node: null,
node: undefined,
duration: 3000,
selector: null,
selector: undefined,
callback: function () {
},
destination: null,
destination: undefined,
newWindow: false,
close: false,
gravity: "toastify-top",
Expand Down

0 comments on commit ae5bae8

Please sign in to comment.