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

vticker has no 'destroy' or 'remove' method #10

Closed
ben-eb opened this issue Nov 26, 2013 · 6 comments
Closed

vticker has no 'destroy' or 'remove' method #10

ben-eb opened this issue Nov 26, 2013 · 6 comments

Comments

@ben-eb
Copy link

ben-eb commented Nov 26, 2013

I'd like to be able to remove an element from the DOM that has an instance of vticker attached to it when my view updates. If I do something like this:

render: function() {
    $('.trackinformation').vTicker({
        speed: 500,
        pause: 3000,
        direction: 'up'
    });
},
close: function() {
    $('.trackinformation').remove();
    $('.trackinformation').unbind();
 }

When the close method is called I get this type error every time the interval is called:

Uncaught TypeError: Cannot read property 'options' of undefined

Even if I call the 'stop' method that still ends up firing this error. What I would like to be able to do is to completely remove vticker from the element. Are there any plans to add this feature?

@ben-eb
Copy link
Author

ben-eb commented Nov 26, 2013

Just realised that the view ends up being removed before the close function gets called so the plugin isn't properly cleaned up, so I fixed the error on my end by calling the stop method. However it would still be nice to be able to remove the plugin from an element in any case.

@richhollis
Copy link
Owner

Hi @ben-eb - so just one method call to remove and unbind? Is that essentially what were talking about here?

@ben-eb
Copy link
Author

ben-eb commented Nov 26, 2013

Essentially, yes; I'd expect such a method call to return the element to the state it was in before vTicker was called, kind of like fullCalendar's way of doing it:

    function destroy() {

        if (currentView) {
            trigger('viewDestroy', currentView, currentView, currentView.element);
            currentView.triggerEventDestroy();
        }

        $(window).unbind('resize', windowResize);

        header.destroy();
        content.remove();
        element.removeClass('fc fc-rtl ui-widget');
    }

http://arshaw.com/fullcalendar/docs/display/destroy/

@richhollis
Copy link
Owner

Ok, sounds like a good idea. I'll look at adding.

@richhollis
Copy link
Owner

v1.14 adds remove method.

@ben-eb
Copy link
Author

ben-eb commented Nov 27, 2013

Great, thank you for resolving it so quickly. 👍

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

2 participants