Skip to content

Commit

Permalink
Merge pull request marcelodolza#9 from emtudo/patch-1
Browse files Browse the repository at this point in the history
add if closed by timeout or click
  • Loading branch information
marcelodolza authored Nov 29, 2016
2 parents 5a1bfb2 + d8bb2dd commit f5c8c0a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dist/js/iziToast.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@
* @public
* @param {Object} options User settings
*/
iziToast.hide = function (options, $toast) {
iziToast.hide = function (options, $toast, closedByButton) {

var settings = extend(defaults, options || {});
var closedByButton = closed || false;

if(typeof $toast != 'object'){
$toast = document.querySelector($toast);
Expand Down Expand Up @@ -399,7 +400,7 @@
}

if(typeof settings.onClose !== "undefined")
settings.onClose.apply();
settings.onClose.apply(null, [settings, $toast, isClosed]);
};

/**
Expand Down Expand Up @@ -640,7 +641,7 @@
}
}

settings.onOpen.apply();
settings.onOpen.apply(null, [settings, $toast]);

try {
var event;
Expand Down Expand Up @@ -696,7 +697,7 @@
if($buttonClose){
$buttonClose.addEventListener('click', function (event) {
var button = event.target;
that.hide(settings, $toast);
that.hide(settings, $toast, true);
});
}

Expand All @@ -721,4 +722,4 @@
};

return iziToast;
});
});

0 comments on commit f5c8c0a

Please sign in to comment.