Countman class
Shared vsync ticker — one scheduleFrameCallback drives all plugins.
插件在添加任务时调用 start。每帧收集各插件 CountmanPlugin.tick 返回的 唤醒时间:有插件要下一帧(或最小值不超过 20ms)就继续排帧;最小值更大就挂一个 全局唯一的休眠 Timer,到点再排帧;全部 idle 则停表,下一次 start 重新启动。 共享帧驱动器,逐插件隔离 tick 与销毁异常。
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- fps ↔ double?
-
全局显示刷新上限(帧/秒);null 跟随 vsync。仅限显示,完成/阈值不延迟。
返回当前设置;非法值 debug 断言、release 视为 null。
示例:
Countman.fps = 30;;运行时修改从下一帧生效。getter/setter pair - isRunning → bool
-
循环是否活跃;休眠期间仍为 true。
no setter
- isSleeping → bool
-
是否有挂起的全局休眠定时器。
no setter
- muteWhenHidden ↔ bool
-
是否让组件随 TickerMode 静音,默认 true;静音时不投递 onUpdate/onTick,
完成与阈值仍按真实时间触发。设置为 false 后组件不订阅 TickerMode。
此开关在组件依赖解析时读取,建议在挂载组件前设置;无返回值。
示例:
Countman.muteWhenHidden = false;。getter/setter pair - pluginCount → int
-
当前按实例注册的插件数量。
no setter
Static Methods
-
destroy(
) → void - Stop the loop and dispose every registered plugin. After destroy, the next start call (e.g. via a new task) rebuilds the plugin set from scratch via use. 逐插件隔离销毁异常,使全部旧插件都得到释放。
-
start(
) → void -
请求立即处理;取消休眠并确保只登记一个帧回调。
例如添加任务时调用
Countman.start();无返回值。 -
stop(
) → void - 立即停表并取消休眠;保留任务,start 可恢复。 Plugins and their tasks are preserved — start resumes them.
-
unuse(
CountmanPlugin plugin, {bool dispose = true}) → bool -
按实例注销
plugin并调用 onDetach,返回是否曾注册。dispose默认为 true;传 false 保留任务,下一次 add 可自注册。 例如Countman.unuse(group, dispose: false)。 -
use(
CountmanPlugin plugin) → void -
按实例注册
plugin,重复注册相同实例无操作。 调试模式拒绝同名的另一实例;请复用实例或提供唯一 name。 例如Countman.use(Countdown(name: 'auction'))。