DEV: ensures relative-ages interval is cleared between tests (#8117)

This commit is contained in:
Joffrey JAFFEUX 2019-10-01 22:18:26 +02:00 committed by GitHub
parent b4d42d1151
commit bbc250cc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -3,9 +3,17 @@ import { updateRelativeAge } from "discourse/lib/formatter";
// Updates the relative ages of dates on the screen.
export default {
name: "relative-ages",
initialize: function() {
setInterval(function() {
initialize() {
this._interval = setInterval(function() {
updateRelativeAge($(".relative-date"));
}, 60 * 1000);
},
teardown() {
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
}
};