Skip to content

Commit

Permalink
Simplify PropSignal methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Jul 17, 2024
1 parent b05ba10 commit ea157b7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/interactivity/src/proxies/signals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export class PropSignal {
this.computedsByScope = new WeakMap();
}

public setValue( value: unknown ): PropSignal {
return this.update( { value } );
public setValue( value: unknown ) {
this.update( { value } );
}

public setGetter( getter: () => any ): PropSignal {
return this.update( { get: getter } );
public setGetter( getter: () => any ) {
this.update( { get: getter } );
}

public getComputed(): ReadonlySignal {
Expand Down Expand Up @@ -63,13 +63,7 @@ export class PropSignal {
return this.computedsByScope.get( scope )!;
}

private update( {
get,
value,
}: {
get?: () => any;
value?: unknown;
} ): PropSignal {
private update( { get, value }: { get?: () => any; value?: unknown } ) {
if ( ! this.valueSignal ) {
this.valueSignal = signal( value );
this.getterSignal = signal( get );
Expand Down

0 comments on commit ea157b7

Please sign in to comment.