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 { ...@@ -68,8 +68,8 @@ export class TagsService {
*/ */
store(tags: string[]) { store(tags: string[]) {
// Update the stored (tag, frequency) map. // Update the stored (tag, frequency) map.
const savedTags: Record<string, Tag> = const savedTags =
this._storage.getObject(TAGS_MAP_KEY) || {}; this._storage.getObject<Record<string, Tag>>(TAGS_MAP_KEY) || {};
tags.forEach(tag => { tags.forEach(tag => {
if (savedTags[tag]) { if (savedTags[tag]) {
savedTags[tag].count += 1; savedTags[tag].count += 1;
......
/** import type { Thread } from '../helpers/build-thread';
* @typedef {import('../helpers/build-thread').Thread} Thread import type { SidebarStore } from '../store';
*/
/** /**
* A service for performing operations related to the current set of threads. * A service for performing operations related to the current set of threads.
*/ */
// @inject // @inject
export class ThreadsService { export class ThreadsService {
/** private _store: SidebarStore;
* @param {import('../store').SidebarStore} store
*/ constructor(store: SidebarStore) {
constructor(store) {
this._store = store; this._store = store;
} }
...@@ -19,10 +17,8 @@ export class ThreadsService { ...@@ -19,10 +17,8 @@ export class ThreadsService {
* "unhiding" a thread which is currently hidden by an applied search filter * "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 * (as well as its child threads). Only threads that are not currently visible
* will be forced visible. * will be forced visible.
*
* @param {Thread} thread
*/ */
forceVisible(thread) { forceVisible(thread: Thread) {
thread.children.forEach(child => { thread.children.forEach(child => {
this.forceVisible(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