Fork of https://github.com/CCherry07/alien-deepsignals ported to alien-signals v2 with support for per-value modification tracking.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

14 lines
346 B

import { Computed as AlienComputed } from 'alien-signals';
export function computed<T>(getter: (cachedValue?: T) => T): Computed<T> {
return new Computed<T>(getter);
}
export class Computed<T = any> extends AlienComputed {
constructor(getter: (cachedValue?: T) => T) {
super(getter);
}
get value(): T {
return this.get();
}
}