alien-signals
Advanced tools
Comparing version 0.4.1 to 0.4.2
{ | ||
"name": "alien-signals", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"license": "MIT", | ||
@@ -38,10 +38,12 @@ "packageManager": "pnpm@9.12.0", | ||
"build:cjs": "esbuild src/index.ts --bundle --format=cjs --outfile=cjs/index.cjs", | ||
"test": "vitest run" | ||
"test": "vitest run", | ||
"bench": "npm run build:esm && node --jitless --expose-gc benchs/propagate.mjs" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "latest", | ||
"mitata": "latest", | ||
"typescript": "latest", | ||
"vite": "latest", | ||
"vitest": "latest", | ||
"typescript": "latest" | ||
"vitest": "latest" | ||
} | ||
} |
import { IComputed, Link, SubscriberFlags } from './system.js'; | ||
export interface ISignal<T = any> { | ||
get(): T; | ||
} | ||
export declare function computed<T>(getter: (cachedValue?: T) => T): ISignal<T>; | ||
export declare class Computed<T = any> implements IComputed { | ||
import type { ISignal } from './types.js'; | ||
export declare function computed<T>(getter: (cachedValue?: T) => T): Computed<T>; | ||
export declare class Computed<T = any> implements IComputed, ISignal<T> { | ||
getter: (cachedValue?: T) => T; | ||
@@ -8,0 +6,0 @@ cachedValue: T | undefined; |
@@ -7,3 +7,3 @@ import { Dependency, IEffect, Link, Subscriber, SubscriberFlags } from './system.js'; | ||
export declare function nextTrackId(): number; | ||
export declare function effect(fn: () => void): Effect<void>; | ||
export declare function effect<T>(fn: () => T): Effect<T>; | ||
export declare class Effect<T = any> implements IEffect, Dependency { | ||
@@ -14,3 +14,2 @@ fn: () => T; | ||
subsTail: Link | undefined; | ||
lastTrackedId: number; | ||
deps: Link | undefined; | ||
@@ -17,0 +16,0 @@ depsTail: Link | undefined; |
@@ -6,2 +6,3 @@ export * from './computed.js'; | ||
export * from './system.js'; | ||
export * from './types.js'; | ||
export * as Unstable from './unstable/index.js'; |
@@ -1,9 +0,6 @@ | ||
import { ISignal } from './computed.js'; | ||
import { Dependency, Link } from './system.js'; | ||
export interface IWritableSignal<T = any> extends ISignal<T> { | ||
set(value: T): void; | ||
} | ||
import type { IWritableSignal } from './types.js'; | ||
export declare function signal<T>(): Signal<T | undefined>; | ||
export declare function signal<T>(oldValue: T): Signal<T>; | ||
export declare class Signal<T = any> implements Dependency { | ||
export declare class Signal<T = any> implements Dependency, IWritableSignal<T> { | ||
currentValue: T; | ||
@@ -10,0 +7,0 @@ subs: Link | undefined; |
@@ -12,3 +12,3 @@ export interface IEffect extends Subscriber { | ||
subsTail: Link | undefined; | ||
lastTrackedId: number; | ||
lastTrackedId?: number; | ||
} | ||
@@ -15,0 +15,0 @@ export interface Subscriber { |
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
47676
27
1589
5