Skip to content

Prevent multiple initialization #251

Open
@phillipberndt

Description

@phillipberndt

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions