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

Prevent multiple initialization #251

Open
phillipberndt opened this issue Dec 1, 2015 · 2 comments
Open

Prevent multiple initialization #251

phillipberndt opened this issue Dec 1, 2015 · 2 comments

Comments

@phillipberndt
Copy link

Apparently, it's easy to get things wrong and call timeago() multiple times on the same element. It would be great if the init function would in this case not set a new interval without clearing the old one, e.g. if you'd replace

if ($s.refreshMillis > 0) {
    this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
}

with

if ($s.refreshMillis > 0 && this._timeagoInterval == null) {
    this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
}
@talha-asad
Copy link

+1

1 similar comment
@neuropass
Copy link

+1

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