Skip to content

Add a destructor#23

Merged
HTMLGuyLLC merged 1 commit intoHTMLGuyLLC:masterfrom
Locutus83:create-deconstructor
Jun 17, 2019
Merged

Add a destructor#23
HTMLGuyLLC merged 1 commit intoHTMLGuyLLC:masterfrom
Locutus83:create-deconstructor

Conversation

@Locutus83
Copy link
Copy Markdown
Contributor

I'm not sure how you feel about this... Our implementation allows the users to close the timeout notification (#jTimedoutAlert) and remain on the page after the server has terminated their session. In order to achieve this, I had to namespace the mousemove event so it could be removed if they closed the alert. this is done in our code by customizing the jAlert with 'closeBtn': true and providing an onClose function. Without this destructor, moving the mouse re-creates countdowns and it tries to keep tracking and updating a session that has terminated.

Do you feel there are other elements that should be destroyed by such a method?

If you don't like the destructor, can I at least get the namespaced mousemove event?

@Locutus83
Copy link
Copy Markdown
Contributor Author

@HTMLGuyLLC Any thoughts on this?

@HTMLGuyLLC
Copy link
Copy Markdown
Owner

Sorry, been tied up with lots of projects. I like the idea of adding a destructor, but I'm concerned about the namespaced mousemove event. How does it get triggered? You didn't add any other code related to mousemove in the plugin, so I assume it's something you have in your project.

@Locutus83
Copy link
Copy Markdown
Contributor Author

It gets triggered the same as any event using the string before the ".". The namespacing is just for specific referencing when using off().
A good explanation can be found here: https://css-tricks.com/namespaced-events-jquery/

@HTMLGuyLLC
Copy link
Copy Markdown
Owner

Love it. Thanks for the reference. I will merge your pull request shortly.

@HTMLGuyLLC HTMLGuyLLC merged commit f58a55b into HTMLGuyLLC:master Jun 17, 2019
@HTMLGuyLLC
Copy link
Copy Markdown
Owner

I changed the method name to destroy() and minimized the JS. Please pull the latest version and test for me if you get a chance. Thank you for your contribution! I gave you credit on the version.

@Locutus83
Copy link
Copy Markdown
Contributor Author

I changed the name of that method 4 or 5 times before creating the pull request. I'm fine with you calling it destroy... that was the first name that I used.
I'll have to test this tomorrow. I have too much going on this evening. I will let you know.

@Locutus83
Copy link
Copy Markdown
Contributor Author

Works like a charm! Thanks!

@Locutus83
Copy link
Copy Markdown
Contributor Author

I just realized that 3.1.0 didn't get released to https://www.npmjs.com/package/jtimeout. Can we get that updated?

@HTMLGuyLLC
Copy link
Copy Markdown
Owner

Done, sorry about that.

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

Successfully merging this pull request may close these issues.

3 participants