jquery-timeago icon indicating copy to clipboard operation
jquery-timeago copied to clipboard

Support unloading timeago elements. fixes #40

Open dshafer opened this issue 13 years ago • 4 comments

Adds explicit untimeago() function that removes all timeago timers and data. Hooks jQuery.events.special.remove to automatically call untimeago() when elements are removed from the DOM

Note, this does not handle automatically removing timeago timers if the DOM elements are removed by some means other than $().remove()

My earlier commit on issue 40 had a bug when calling untimeago() on non-timeago elements. This single commit includes the untimeago implementation with the fix for that bug (i.e. the earlier commit should be disregarded)

dshafer avatar Sep 07 '12 21:09 dshafer

This fix is working, thank you.

zakjan avatar Oct 05 '12 12:10 zakjan

Useful Commit. Would like to see this in timeago.

bhargavgolla avatar Nov 26 '12 07:11 bhargavgolla

I'm sorry for not keeping up with this project lately. I like the idea behind this PR, but it needs some rebasing first.

The core codebase has changed a bit, and it would probably be better to use our new functions convention instead of instead of $.fn.untimeago. Something like $(…).timeago("remove"). I'm not sure what the function name should be, but maybe there's good precedence out there for this kind of thing.

Brainstorming:

  • $(…).timeago("remove")
  • $(…).timeago("delete")
  • $(…).timeago("off")
  • $(…).timeago("unload")

rmm5t avatar Oct 02 '13 14:10 rmm5t

remove is probably the best name (matches jQuery's $.remove functionality) if it turns off the timeago functionality and fully cleans up everything.

You should also look at #30 - that's been helpful for us in dealing with leaks. The idea is that you should be able to call timeago() multiple times on the page (perhaps each time you add to the DOM) without having to worry about cleaning up the previous.

philfreo avatar Oct 02 '13 16:10 philfreo