File

core/common/interval-based-reload.abstract.ts

Description

Abstract class representing an interval reload functionality. This class provides methods and properties for managing an interval-based reload mechanism.

Index

Properties
Methods

Properties

Abstract countdownIntervalComponent
Type : CountdownIntervalComponent
Protected Abstract hideCountdown
Type : boolean

Controls the visibility of the countdown timer component in the current component's UI.

isAutoRefreshEnabled
Type : boolean

Indicates whether auto-refresh is enabled for the datapoints reload component that is set in widget config.

Abstract isIntervalRefreshToggleOn
Type : boolean

Indicates the current state of an interval refresh toggle button.

Abstract isLoading
Type : Signal<boolean>

Current isLoading state. Based on it next countdown cycle is being started.

Abstract isScrolling
Type : boolean

Indicates whether the alarm list is being scrolled or not.

Protected Abstract manuallyDisabledCountdown
Type : boolean

Indicates whether the countdown has been manually disabled by the user.

Abstract onCountdownEnded
Type : EventEmitter<void>

Indicates that a countdown cycle has ended.

Abstract refreshInterval
Type : number

Current refresh interval set in a widget config.

Abstract toggleCountdownButtonTooltipText
Type : string

Methods

autoRefreshList
autoRefreshList()

Stops the countdown and triggers a refresh action. This function is responsible for halting the countdown interval component's operation. After stopping the countdown, it emits an onCountdownEnded event. This event is used to inform external components that the countdown has ended, typically prompting them to reload or refresh their data.

Returns : void
Abstract countdownEnded
countdownEnded()

Wrapper method where it's name better describes a context where it was called.

Returns : void
disableCountdown
disableCountdown()

Disables and hides the countdown timer.

This method stops the ongoing countdown process by stopping the countdownIntervalComponent if it exists. It then hides the countdown timer by setting hideCountdown to true. This method encapsulates the logic required to halt and conceal the countdown timer.

Returns : void
Abstract enableCountdown
enableCountdown()

Enables and starts the countdown timer.

This method makes the countdown visible (hideCountdown is set to false) and then starts the countdown process. It ensures the countdown timer is updated immediately by triggering change detection with cdRef.detectChanges() before starting the countdown. This method encapsulates the logic required to initiate the countdown timer.

Returns : void
handleScrolling
handleScrolling()

Manages the countdown timer's visibility and state in response to user scrolling.

This method toggles the countdown timer based on the user's scrolling behavior. It uses the disableCountdown and enableCountdown methods for handling the countdown state.

  • If the user is scrolling down while the countdown is visible (isScrolling is true and hideCountdown is false), disableCountdown is called to stop and hide the countdown, and isIntervalRefreshToggleOn is set to false.

  • If the user has stopped scrolling, the countdown subscription is closed, and the countdown is hidden (!isScrolling, countdownSubscription?.closed, hideCountdown), enableCountdown is called to show and restart the countdown, and isIntervalRefreshToggleOn is set to true.

Returns : void
onToggleCountdownButtonState
onToggleCountdownButtonState($event: MouseEvent)

Handles the toggle state of the countdown on button click.

This method is triggered by a mouse event, typically a click on the countdown toggle button. It toggles isIntervalRefreshToggleOn to reflect the current state of the countdown timer.

  • If isIntervalRefreshToggleOn is set to false, indicating that the countdown should be stopped, disableCountdown is called, and manuallyDisabledCountdown is set to true.

  • If isIntervalRefreshToggleOn is true and the countdown subscription is closed, indicating that the countdown can be started, enableCountdown is called, and manuallyDisabledCountdown is set to false.

Parameters :
Name Type Optional Description
$event MouseEvent No
  • The MouseEvent that triggered this method.
Returns : void
Abstract reload
reload()
Returns : void
startCountdown
startCountdown(injector: Injector)

This function listens for changes in the isLoading observable, filtering out any truthy values. Once a falsy value is detected (indicating that loading has finished), it attempts to start the countdown.

IMPORTANT: If the widget's configuration (refreshInterval, check template) is not set prior to executing countdownIntervalComponent?.start, the countdown interval will not start!

Example :
              within the `runInInjectionContext`.
Parameters :
Name Type Optional Description
injector Injector No
  • The injector used to provide necessary dependencies within the runInInjectionContext.
Returns : void
Protected Abstract updateCountdownButtonTooltipText
updateCountdownButtonTooltipText()

Updates the countdown button tooltip text based on the state of the interval refresh toggle state.

Returns : void

results matching ""

    No results matching ""