diff --git a/ivette/src/frama-c/states.ts b/ivette/src/frama-c/states.ts index 5f5715e562f8b727939a36829e36ce40da2de47e..ff3ba19aa7bc01cb746eb05677a6a72b709d44c8 100644 --- a/ivette/src/frama-c/states.ts +++ b/ivette/src/frama-c/states.ts @@ -3,10 +3,9 @@ // -------------------------------------------------------------------------- /** - @packageDocumentation - @module frama-c/states - @decsription - Manage the current Frama-C project and projectified state values. + * Manage the current Frama-C project and projectified state values. + * @packageDocumentation + * @module frama-c/states */ import React from 'react'; @@ -59,7 +58,8 @@ Server.onShutdown(() => { // -------------------------------------------------------------------------- /** - Current Project (Custom React Hook). + * Current Project (Custom React Hook). + * @return The current project. */ export function useProject() { Dome.useUpdate(PROJECT); @@ -67,10 +67,12 @@ export function useProject() { } /** - Update Current Project. - Make all states switching to their projectified value. - Emits `PROJECT`. - @param project - the project identifier + * Update Current Project. + * + * Make all states switching to their projectified value. + * + * Emits `PROJECT`. + * @param project The project identifier. */ export async function setProject(project: string) { if (Server.isRunning()) { @@ -101,12 +103,12 @@ export interface UseRequestOptions<A> { } /** - Cached GET request (Custom React Hook). - - Sends the specified GET request and returns its result. - The request is send asynchronously and cached until any change. - - Null values in options mean that the last obtained value is kept. + * Cached GET request (Custom React Hook). + * + * Sends the specified GET request and returns its result. The request is send + * asynchronously and cached until any change. + * + * Null values in options mean that the last obtained value is kept. */ export function useRequest<In, Out>( rq: Server.GetRequest<In, Out>, @@ -251,7 +253,7 @@ class SyncState<A> { Dome.emit(this.UPDATE); } catch (error) { PP.error( - `Fail to set value of syncState '${this.handler.name}'.`, + `Fail to set value of SyncState '${this.handler.name}'.`, `${error.toString()}`, ); } @@ -265,7 +267,7 @@ class SyncState<A> { Dome.emit(this.UPDATE); } catch (error) { PP.error( - `Fail to update syncState '${this.handler.name}'.`, + `Fail to update SyncState '${this.handler.name}'.`, `${error.toString()}`, ); } @@ -294,9 +296,7 @@ Server.onShutdown(() => syncStates.clear()); // --- Synchronized State Hooks // -------------------------------------------------------------------------- -/** - Synchronization with a (projectified) server state. - */ +/** Synchronization with a (projectified) server state. */ export function useSyncState<A>( st: State<A>, ): [A | undefined, (value: A) => void] { @@ -306,9 +306,7 @@ export function useSyncState<A>( return [s.getValue(), s.setValue]; } -/** - Synchronization with a (projectified) server value. - */ +/** Synchronization with a (projectified) server value. */ export function useSyncValue<A>(va: Value<A>): A | undefined { const s = getSyncState(va); Dome.useUpdate(s.update); @@ -413,9 +411,7 @@ Server.onShutdown(() => syncArrays.clear()); // --- Synchronized Array Hooks // -------------------------------------------------------------------------- -/** - Force a Synchronized Array to Reload. -*/ +/** Force a Synchronized Array to reload. */ export function reloadArray<K, A>(arr: Array<K, A>) { getSyncArray(arr).reload(); } @@ -423,11 +419,11 @@ export function reloadArray<K, A>(arr: Array<K, A>) { /** Use Synchronized Array (Custom React Hook). - Unless specified, the hook makes the component re-rendering on every - updates. Disabling this automatic re-renderer can be an option when - you only use the model to make a table view, - which automatically synchronizes on model updates. - @param sync - whether the component re-render on updates (default is `true`) + Unless specified, the hook makes the component re-render on every + update. Disabling this automatic re-rendering can be an option when + using the model to make a table view, which automatically synchronizes on + model updates. + @param sync Whether the component re-renders on updates (default is `true`). */ export function useSyncArray<K, A>( arr: Array<K, A>, @@ -475,7 +471,7 @@ export interface HistorySelection { * - `HISTORY_NEXT` jumps to next history location * (first in [[nextSelections]]). */ -type HistorySelectActions = 'HISTORY_PREV' | 'HISTORY_NEXT'; +export type HistorySelectActions = 'HISTORY_PREV' | 'HISTORY_NEXT'; /** A selection of multiple locations. */ export interface MultipleSelection { @@ -502,7 +498,7 @@ export interface NthSelect { * - `MULTIPLE_PREV` jumps to previous location of the multiple selections. * - `MULTIPLE_NEXT` jumps to next location of the multiple selections. */ -type MultipleSelectActions = +export type MultipleSelectActions = MultipleSelect | NthSelect | 'MULTIPLE_PREV' | 'MULTIPLE_NEXT' | 'MULTIPLE_CLEAR'; @@ -683,9 +679,7 @@ const emptySelection = { const GlobalSelection = new GlobalStates.State<Selection>(emptySelection); Server.onShutdown(() => GlobalSelection.setValue(emptySelection)); -/** - Current selection. - */ +/** Current selection. */ export function useSelection(): [Selection, (a: SelectionActions) => void] { const [selection, setSelection] = GlobalStates.useState(GlobalSelection);