Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button hide no longer works from 1.2 to 1.3 #109

Closed
dougroutledge opened this issue Jan 20, 2018 · 6 comments
Closed

Button hide no longer works from 1.2 to 1.3 #109

dougroutledge opened this issue Jan 20, 2018 · 6 comments

Comments

@dougroutledge
Copy link

After update to 1.3, the code to hide the toast after a a yes/no button click no longer works. This error is thrown.

iziToast.min.js:6 Uncaught TypeError: Cannot read property 'add' of undefined
at Object.e.hide (iziToast.min.js:6)
at ciscoconsole.min.js:1
at HTMLButtonElement. (iziToast.min.js:6)

@marcelodolza
Copy link
Owner

How are you using?

@marcelodolza
Copy link
Owner

marcelodolza commented Mar 4, 2018

Function structure:
$iziToast.hide = function (options, $toast, closedBy)

How to use:
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');

@codaxiom
Copy link

codaxiom commented Mar 8, 2018

Actually, the function signature not matches what you say.
The options and toast parameters are inverted, so it causes the function hide to fail because it's apply on the options object.

$iziToast.hide = function ($toast, options, closedBy) {
	...
	> $toast.classList.add(PLUGIN_NAME+'-closing');
	...
}

If you swap the two parameters, everything works again.

@marcelodolza
Copy link
Owner

marcelodolza commented Mar 8, 2018

Negative. This is the correct signature of the function:
$iziToast.hide = function (options, $toast, closedBy) {
It has been changed for some time. is the default like all other methods.

Line 515
https://github.com/dolce/iziToast/blob/master/src/js/iziToast.js#L515

@codaxiom
Copy link

codaxiom commented Mar 8, 2018

Hm, it's because i have reinstalled your package with version 1.2, so it's break as i copy from documentation which use the latest signature. Thanks for you reactivity and your amazing work on this project

@marcelodolza
Copy link
Owner

Thank you. I will correct a few more things in v1.3 and will soon publish in NPM.
Stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants