Additional control over Twitch.ext.bits.useBits function
I would like to suggest a new callbackFunction argument passed into the current useBits(sku: String) function.
The new callbackFunction as an argument would take on this function prototype:
useBits: void function(sku: String , callbackFunction: function).
It would be great to have payments be processed only when the specific callbackFunction returns true, otherwise do not process the payment and return a message to the user in the open dialog.
For example:
useBits(sku, callbackFunction){
...
if (callbackFunction() == true){
// purchase sku
}
else{
// do not process sku, and return
}
...
}
Although helpful, bits.onTransactionComplete only gets called after the payment is already made. Having more control wether to process the payment or not with a callbackFunction would allow more control in use cases where resources become unavailable when the dialog box is left open for a long period of time (race condition for a resource that no longer exists).
This will be a huge benefit to developers who currently have no way of navigating around this.