UI Button - momentary function

Hello, just thought I should suggest a feature to be added to the UI Button. Currently you can configure the message to be sent when the button is clicked (pressed DOWN).

image

I see several use cases where a momentary function is needed. So what if there was a possible setting for "When released, send:" as well? If filled in it will be sent

Right know I have a solution based on a UI Template with code borrowed & provided by other users on the board but I think it would be better to have this feature as standard, available in the UI Button itself

<div class="momentary">
   <md-button> R1 ON/OFF</md-button>
</div>

<script>

(function($scope) {
    
$('.momentary').on('touchstart mousedown', function(e) {
    e.preventDefault(); //prevent default behavior
    $scope.send({"payload": "R1_ON,127.0.0.1"});
});

$('.momentary').on('touchend mouseup', function(e) {
    e.preventDefault(); //prevent default behavior
    $scope.send({"payload": "R1_OFF,127.0.0.1"});
});
    
})(scope);
</script>

As far as I can see the underlying angular material md-button we use doesn't expose this functionality so we won't be adding it any time soon unless someone comes up with a clever pull request.

OK, I was not aware of such dependency, fine, got it

Some ideas here