EffectOptions#
Kind:
class |
Package: package:preact_signals
Class: EffectOptions#
Configuration options for reactive Effects.
Permits naming the effect for debugging, performance profiling, and tracing within the signals developer tools.
Example Usage#
import 'package:preact_signals/preact_signals.dart';
final count = signal(0);
final logger = effect(
() => print('Count changed to: ${count.value}'),
options: const EffectOptions(name: 'counter-logger'),
);
Members of EffectOptions#
| Member | Type | Signature | Description |
|---|---|---|---|
| EffectOptions | constructor |
dart EffectOptions({super.name}) |
Creates a new EffectOptions instance. |
| copyWith | method |
dart EffectOptions copyWith({String? name}) |
Creates a copy of this options with custom overrides. |
| == | method |
dart bool ==(Object other) |
|
| hashCode | method |
dart int hashCode |
Class: EffectOptions#
Configuration options for reactive Effects extending signals.EffectOptions.
Members of EffectOptions#
| Member | Type | Signature | Description |
|---|---|---|---|
| autoDispose | field |
dart bool autoDispose |
Automatically dispose the signal when there are no more listeners. |
| onDispose | field |
dart void Function()? onDispose |
Callback called when the effect is disposed. |
| EffectOptions | constructor |
dart EffectOptions({super.name, this.autoDispose = false, this.onDispose}) |
Creates a new EffectOptions instance. |
| copyWith | method |
dart EffectOptions copyWith({String? name, bool? autoDispose, void Function()? onDispose})
|
|
| == | method |
dart bool ==(Object other) |
|
| hashCode | method |
dart int hashCode |
References#
The EffectOptions type is referenced and used in the following pages: