alien-signals
Advanced tools
Comparing version 0.4.5 to 0.4.6
{ | ||
"name": "alien-signals", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "The lightest signal library.", |
@@ -9,6 +9,9 @@ <p align="center"> | ||
<h3 align="center"> | ||
<p>[<a href="https://github.com/YanqingXu/alien-signals-in-lua">Alien Signals in Lua</a>]</p> | ||
<p>[<a href="https://github.com/medz/alien-signals-dart">Alien Signals in Dart</a>]</p> | ||
</h3> | ||
# alien-signals | ||
Project Status: **Preview** | ||
The goal of `alien-signals` is to create a push-pull model based signal library with the lowest overhead. | ||
@@ -35,6 +38,2 @@ | ||
## Other Languages | ||
- Lua: https://github.com/YanqingXu/alien-signals-in-lua | ||
## Adoptions | ||
@@ -100,17 +99,25 @@ | ||
const sub = link.sub; | ||
const subFlags = sub.flags; | ||
let subFlags = sub.flags; | ||
if (!(subFlags & SubscriberFlags.Tracking)) { | ||
let canPropagate = !(subFlags >> 2); | ||
if (!canPropagate && subFlags & SubscriberFlags.CanPropagate) { | ||
sub.flags &= ~SubscriberFlags.CanPropagate; | ||
canPropagate = true; | ||
if (!canPropagate) { | ||
if (subFlags & SubscriberFlags.CanPropagate) { | ||
sub.flags = (subFlags & ~SubscriberFlags.CanPropagate) | targetFlag; | ||
canPropagate = true; | ||
} else if (!(subFlags & targetFlag)) { | ||
sub.flags = subFlags | targetFlag; | ||
} | ||
} else { | ||
sub.flags = subFlags | targetFlag; | ||
} | ||
if (canPropagate) { | ||
sub.flags |= targetFlag; | ||
const subSubs = (sub as Dependency).subs; | ||
if (subSubs !== undefined) { | ||
propagate(subSubs, 'notify' in sub | ||
? SubscriberFlags.RunInnerEffects | ||
: SubscriberFlags.ToCheckDirty); | ||
propagate( | ||
subSubs, | ||
'notify' in sub | ||
? SubscriberFlags.RunInnerEffects | ||
: SubscriberFlags.ToCheckDirty | ||
); | ||
} else if ('notify' in sub) { | ||
@@ -124,16 +131,17 @@ if (queuedEffectsTail !== undefined) { | ||
} | ||
} else if (!(sub.flags & targetFlag)) { | ||
sub.flags |= targetFlag; | ||
} | ||
} else if (isValidLink(link, sub)) { | ||
if (!(subFlags >> 2)) { | ||
sub.flags |= targetFlag | SubscriberFlags.CanPropagate; | ||
sub.flags = subFlags | targetFlag | SubscriberFlags.CanPropagate; | ||
const subSubs = (sub as Dependency).subs; | ||
if (subSubs !== undefined) { | ||
propagate(subSubs, 'notify' in sub | ||
? SubscriberFlags.RunInnerEffects | ||
: SubscriberFlags.ToCheckDirty); | ||
propagate( | ||
subSubs, | ||
'notify' in sub | ||
? SubscriberFlags.RunInnerEffects | ||
: SubscriberFlags.ToCheckDirty | ||
); | ||
} | ||
} else if (!(sub.flags & targetFlag)) { | ||
sub.flags |= targetFlag; | ||
} else if (!(subFlags & targetFlag)) { | ||
sub.flags = subFlags | targetFlag; | ||
} | ||
@@ -140,0 +148,0 @@ } |
@@ -6,4 +6,3 @@ import { IComputed, Link, SubscriberFlags } from './system.js'; | ||
getter: (cachedValue?: T) => T; | ||
cachedValue: T | undefined; | ||
version: number; | ||
currentValue: T | undefined; | ||
subs: Link | undefined; | ||
@@ -17,3 +16,3 @@ subsTail: Link | undefined; | ||
get(): T; | ||
update(): boolean; | ||
update(): T; | ||
} |
@@ -6,6 +6,6 @@ export interface IEffect extends Subscriber { | ||
export interface IComputed extends Dependency, Subscriber { | ||
version: number; | ||
update(): boolean; | ||
update(): any; | ||
} | ||
export interface Dependency { | ||
currentValue?: any; | ||
subs: Link | undefined; | ||
@@ -23,3 +23,3 @@ subsTail: Link | undefined; | ||
sub: Subscriber | IComputed | (Dependency & IEffect) | IEffect; | ||
version: number; | ||
value: any; | ||
prevSub: Link | undefined; | ||
@@ -41,4 +41,4 @@ nextSub: Link | undefined; | ||
export declare function propagate(subs: Link): void; | ||
export declare function checkDirty(deps: Link): boolean; | ||
export declare function checkDirty(link: Link): boolean; | ||
export declare function startTrack(sub: Subscriber): void; | ||
export declare function endTrack(sub: Subscriber): void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52785
1633
195