ui.Slider.onChange
Registers a callback that's fired when the slider's state changes. If the change is due to the user dragging the slider, the event will not fire until the drag completes.
Returns an ID which can be passed to unlisten() to unregister the callback.
Usage | Returns |
---|
Slider.onChange(callback) | String |
Argument | Type | Details |
---|
this: ui.slider | ui.Slider | The ui.Slider instance. |
callback | Function | The callback to fire when the slider's state changes. The callback is passed the slider's current value and the slider widget. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["The `onChange` method registers a callback function that is triggered when the slider's value changes, but only after a user completes dragging the slider."],["It returns a unique ID that can be used with the `unlisten()` method to remove the registered callback."],["The callback function receives the slider's current value and the slider widget itself as arguments when invoked."]]],["The `Slider.onChange` method registers a callback function to be executed when a slider's state changes. This callback is triggered after a user completes dragging the slider, not during the drag. The method accepts a callback function as an argument, which receives the slider's current value and the slider widget itself. It returns a unique ID (string) that can be used to unregister the callback later using `unlisten()`.\n"]]