Skip to content

Commit c2f868c

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

File tree

1 file changed

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

1 file changed

+6
-4
lines changed

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

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

25-
this._scale = fcn;
26-
debug( 'New Value: %s.', this._scale );
26+
this._scale = fcn;
27+
debug( 'New Value: %s.', this._scale );
2728

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

3133

0 commit comments

Comments
 (0)