- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
refactor: system alien_signals
Showing
13 changed files
with
65 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
import 'package:alien_signals/alien_signals.dart'; | ||
import 'package:alien_signals/preset.dart'; | ||
|
||
void loop() {} | ||
|
||
extension EffectScopeUtils on EffectScope { | ||
void Function() on() { | ||
final prevScope = activeEffectScope; | ||
setActiveScope(this); | ||
return () => setActiveScope(prevScope); | ||
final prevScope = system.activeScope; | ||
system.activeScope = this; | ||
return () { | ||
system.activeScope = prevScope; | ||
}; | ||
} | ||
} | ||
|
||
extension EffectUtils on Effect { | ||
void Function() on([EffectScope? scope]) { | ||
final reset = scope?.on(); | ||
final prevSub = activeSub; | ||
setActiveSub(this); | ||
startTrack(this); | ||
final prevSub = system.activeSub; | ||
|
||
system.activeSub = this; | ||
system.startTracking(this); | ||
return () { | ||
reset?.call(); | ||
setActiveSub(prevSub); | ||
endTrack(this); | ||
system.activeSub = prevSub; | ||
system.endTracking(this); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import 'upstream.dart'; | ||
|
||
extension ValueSignal<T> on ISignal<T> { | ||
T get value => get(); | ||
extension ValueSignal<T> on Signal<T> { | ||
T get value => this(); | ||
} | ||
|
||
extension ValueWritableSignal<T> on IWritableSignal<T> { | ||
T get value => get(); | ||
set value(T value) => set(value); | ||
extension ValueWritableSignal<T> on WriteableSignal<T> { | ||
T get value => this(); | ||
set value(T value) => this(value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
export 'package:alien_signals/alien_signals.dart' | ||
show | ||
Signal, | ||
Computed, | ||
Effect, | ||
EffectScope, | ||
ISignal, | ||
IWritableSignal, | ||
untrack, | ||
untrackScope; | ||
export 'package:alien_signals/preset.dart' | ||
show Signal, WriteableSignal, Computed, Effect, EffectScope; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters