Skip to content

Commit

Permalink
feat: remove interface ComputedRef
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Oct 14, 2023
1 parent b141c32 commit 54dba6a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export type {
} from 'redux';
export type { Model } from './model/types';
export type { StorageEngine } from './engines/StorageEngine';
export type { ComputedRef } from './reactive/types';
4 changes: 2 additions & 2 deletions src/reactive/ComputedValue.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Store } from 'redux';
import type { ComputedRef, Deps } from './types';
import { depsCollector } from './depsCollector';
import { createComputedDeps } from './createComputedDeps';
import type { Deps } from './ObjectDeps';

export class ComputedValue<T = any> implements ComputedRef<T> {
export class ComputedValue<T = any> {
public deps: Deps[] = [];
public snapshot: any;

Expand Down
7 changes: 6 additions & 1 deletion src/reactive/ObjectDeps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import type { Store } from 'redux';
import { isObject } from '../utils/isType';
import { depsCollector } from './depsCollector';
import type { Deps } from './types';

export interface Deps {
id: string;
end(): void;
isDirty(): boolean;
}

export class ObjectDeps<T = any> implements Deps {
protected active: boolean = true;
Expand Down
2 changes: 1 addition & 1 deletion src/reactive/createComputedDeps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shallowEqual } from 'react-redux';
import type { ComputedValue } from './ComputedValue';
import type { Deps } from './types';
import type { Deps } from './ObjectDeps';

export const createComputedDeps = (body: ComputedValue): Deps => {
let snapshot: any;
Expand Down
2 changes: 1 addition & 1 deletion src/reactive/depsCollector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Deps } from './types';
import type { Deps } from './ObjectDeps';

const deps: Deps[][] = [];
let level = -1;
Expand Down
9 changes: 0 additions & 9 deletions src/reactive/types.ts

This file was deleted.

0 comments on commit 54dba6a

Please sign in to comment.