Skip to content

Commit 7953386

Browse files
committed
Only fire a change event when provided a new value
1 parent c2f868c commit 7953386

File tree

1 file changed

+6
-4
lines changed
  • lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size

1 file changed

+6
-4
lines changed

lib/node_modules/@stdlib/plot/components/svg/rug/lib/props/size/set.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ function set( size ) {
2020
if ( !isNonNegativeInteger( size ) ) {
2121
throw new TypeError( 'invalid value. `size` must be a nonnegative integer. Value: `' + size + '.`' );
2222
}
23-
debug( 'Current value: %d.', this._size );
23+
if ( size !== this._size ) {
24+
debug( 'Current value: %d.', this._size );
2425

25-
this._size = size;
26-
debug( 'New Value: %d.', this._size );
26+
this._size = size;
27+
debug( 'New Value: %d.', this._size );
2728

28-
this.emit( 'change' );
29+
this.emit( 'change' );
30+
}
2931
} // end FUNCTION set()
3032

3133

0 commit comments

Comments
 (0)