From 73ba955e344c8ccedd43235495ef8b72b5a2b6fd Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Wed, 22 Jun 2022 00:32:18 +0200 Subject: chore: Transform AppStore.js into Typescript (#329) * turn actions into typescript * correct tsconfig * added TypedStore --- src/stores/lib/Reaction.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/stores/lib/Reaction.ts') diff --git a/src/stores/lib/Reaction.ts b/src/stores/lib/Reaction.ts index 0ca24a6fa..3966c8073 100644 --- a/src/stores/lib/Reaction.ts +++ b/src/stores/lib/Reaction.ts @@ -1,24 +1,24 @@ -import { autorun } from 'mobx'; +import { autorun, IReactionDisposer, IReactionPublic } from 'mobx'; export default class Reaction { - reaction; + public reaction: (r: IReactionPublic) => any; - isRunning = false; + private isRunning: boolean = false; - dispose; + public dispose?: IReactionDisposer; - constructor(reaction) { + constructor(reaction: any) { this.reaction = reaction; } - start() { + start(): void { if (!this.isRunning) { this.dispose = autorun(this.reaction); this.isRunning = true; } } - stop() { + stop(): void { if (this.isRunning) { this.dispose?.(); this.isRunning = false; -- cgit v1.2.3-70-g09d2