Sha256: 89537ca49778d169358f3ca7877eef7c68d5807441a97bcd97736e9554dc8026
Contents?: true
Size: 1.27 KB
Versions: 7
Compression:
Stored size: 1.27 KB
Contents
import Route from "@ember/routing/route"; import MessageCollection from "client-app/models/message-collection"; import { isHidden } from "client-app/lib/utilities"; export default Route.extend({ model() { // TODO from preload json? return MessageCollection.create(); }, setupController(controller, model) { this._super(controller, model); controller.setProperties({ showDebug: true, showInfo: true, showWarn: true, showErr: true, showFatal: true, search: "", initialized: true }); model.reload(); let times = 0; let backoff = 1; this.refreshInterval = setInterval(() => { times += 1; const hidden = isHidden(); let load = !hidden; if (hidden) { if (times % backoff === 0) { load = true; if (backoff < 20) { backoff++; } } } // refresh a lot less aggressively in background if (load) { model.loadMore(); if (!hidden) { backoff = 1; } } }, 3000); this.events.on("panelResized", amount => { controller.resizePanels(amount); }); }, deactivate() { clearInterval(this.refreshInterval); } });
Version data entries
7 entries across 7 versions & 1 rubygems