Commit eabf7f89 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Migrate ThreadsService to TS

parent 2b8b9411
......@@ -68,8 +68,8 @@ export class TagsService {
*/
store(tags: string[]) {
// Update the stored (tag, frequency) map.
const savedTags: Record<string, Tag> =
this._storage.getObject(TAGS_MAP_KEY) || {};
const savedTags =
this._storage.getObject<Record<string, Tag>>(TAGS_MAP_KEY) || {};
tags.forEach(tag => {
if (savedTags[tag]) {
savedTags[tag].count += 1;
......
/**
* @typedef {import('../helpers/build-thread').Thread} Thread
*/
import type { Thread } from '../helpers/build-thread';
import type { SidebarStore } from '../store';
/**
* A service for performing operations related to the current set of threads.
*/
// @inject
export class ThreadsService {
/**
* @param {import('../store').SidebarStore} store
*/
constructor(store) {
private _store: SidebarStore;
constructor(store: SidebarStore) {
this._store = store;
}
......@@ -19,10 +17,8 @@ export class ThreadsService {
* "unhiding" a thread which is currently hidden by an applied search filter
* (as well as its child threads). Only threads that are not currently visible
* will be forced visible.
*
* @param {Thread} thread
*/
forceVisible(thread) {
forceVisible(thread: Thread) {
thread.children.forEach(child => {
this.forceVisible(child);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment