Skip to content

Commit 2d70824

Browse files
committed
feat: async events for await triggers
1 parent 77d5fbb commit 2d70824

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class InputSpinner extends Component {
9292
* On value change
9393
* @param num
9494
*/
95-
onChange(num) {
95+
async onChange(num) {
9696
if (this.props.disabled) return;
9797
const current_value = this.state.value;
9898
const separator = !this.isStringEmpty(this.props.decimalSeparator)
@@ -119,7 +119,7 @@ class InputSpinner extends Component {
119119
num = this.state.min;
120120
}
121121
if (current_value !== num && this.props.onChange) {
122-
const res = this.props.onChange(num);
122+
const res = await this.props.onChange(num);
123123
if (res === false) {
124124
return;
125125
} else if (this.isNumeric(res)) {
@@ -269,7 +269,7 @@ class InputSpinner extends Component {
269269
/**
270270
* Increase
271271
*/
272-
increase() {
272+
async increase() {
273273
if (this._isDisabledButtonRight()) return;
274274
let num =
275275
this.parseNum(this.state.value) + this.parseNum(this.state.step);
@@ -278,7 +278,7 @@ class InputSpinner extends Component {
278278
if (this.maxReached(num)) {
279279
increased_num = this.state.max;
280280
}
281-
const res = this.props.onIncrease(increased_num);
281+
const res = await this.props.onIncrease(increased_num);
282282
if (res === false) {
283283
return;
284284
} else if (this.isNumeric(res)) {
@@ -291,7 +291,7 @@ class InputSpinner extends Component {
291291
/**
292292
* Decrease
293293
*/
294-
decrease() {
294+
async decrease() {
295295
if (this._isDisabledButtonLeft()) return;
296296
let num =
297297
this.parseNum(this.state.value) - this.parseNum(this.state.step);
@@ -300,7 +300,7 @@ class InputSpinner extends Component {
300300
if (this.minReached(num)) {
301301
decreased_num = this.state.min;
302302
}
303-
const res = this.props.onDecrease(decreased_num);
303+
const res = await this.props.onDecrease(decreased_num);
304304
if (res === false) {
305305
return;
306306
} else if (this.isNumeric(res)) {

0 commit comments

Comments
 (0)