Skip to content

Commit

Permalink
* core: add computed helper to create instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Aug 28, 2024
1 parent d09a36b commit d9836b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/core/src/helpers/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ export class Computed<T = unknown, D extends unknown[] = unknown[]> {
return this._value as T;
}
}

export function computed<T = unknown, D extends unknown[] = unknown[]>(compute: () => T, dependencies: D | (() => D)) {
return new Computed(compute, dependencies);
}

0 comments on commit d9836b2

Please sign in to comment.