Skip to content
fandhe-frontend
GitHub

Timer

fandhe-frontend-pre-styled-uitimer mod が提供するスタイル済み Timer 部品です。

関連 API: fandhe-frontend-pre-styled-ui API / fandhe-frontend-headless-ui API

Demo

headless-ui の Timer(tick 注入型・idle/running/paused/completed の決定的状態機械)に pre-styled-ui のセグメント表示(分:秒)CSS を適用した静的掲示です。90 秒のカウントダウンを開始して 35 秒経過した running 状態を固定表示しています。実 tick 駆動(setInterval)は fandhe-frontend-wasm-full::headless_timer のスコープです。

00Min
:
55Sec

Features

  • tick 注入型・idle/running/paused/completed の決定的状態機械(fandhe-frontend-interactive の dispatch 経由)
  • countdown(カウントダウン)と count_up(カウントアップ)の 2 モードを持つ
  • 実 tick 駆動(setInterval)は fandhe-frontend-wasm-full 側のスコープ(本ページは SSR 静的掲示)

Anatomy

root
  area
    item
      item-value
      item-label
    separator
  control
    action-trigger

API Reference

Arguments

NameTypeDefaultDescription
Timer::countdownfn(start_ms, interval_ms) -> Timerカウントダウン型 Timer を構築する。
Timer::count_upfn(target_ms, interval_ms) -> Timerカウントアップ型 Timer を構築する。

Data Attributes

PartAttributeObserved Values
action-triggerdata-actionpause, reset
itemdata-typeminutes, seconds
item-labeldata-typeminutes, seconds
item-valuedata-typeminutes, seconds
rootdata-countdown
rootdata-elapsed35000
rootdata-interval1000
rootdata-start-ms90000
rootdata-staterunning
rootdata-target-ms0

Examples

90 秒カウントダウン(35 秒経過)

start → 35 秒分の tick を注入した running 状態を固定表示します。

00Min
:
55Sec

Accessibility

WAI-ARIA

AttributeDescription
aria-live経過表示の更新を支援技術へ通知する(headless-ui 側の root パーツが付与)。