call method

EffectScope call({
  1. bool? detach,
  2. JoltDebugFn? onDebug,
})

Creates an effect scope hook for managing groups of effects.

Effect scopes allow you to group related effects and dispose them together.

Parameters:

  • detach: Whether to detach the scope from the current effect context
  • onDebug: Optional debug callback for reactive system debugging

Returns: An EffectScope for managing effect lifecycles

Example:

setup(context, props) {
  final scope = useEffectScope();

  onMounted(() {
    scope.run(() {
      final signal = Signal(0);
      Effect(() => print(signal.value));

      onScopeDispose(() => print('Scope cleaned up'));
    });
  });

  return () => Text('Hello');
}

Implementation

EffectScope call({
  bool? detach,
  JoltDebugFn? onDebug,
}) {
  return useAutoDispose(() => EffectScope(detach: detach, onDebug: onDebug));
}