Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext.Msg.confirm inside function return value

I need to create a function that returns a (boolean)result when the user clicks yes or no. I'm using a Ext.Msg.confirm. Below my function (testcase).

function returnAnswer() {
    Ext.Msg.confirm(
        'HardCoded',
        'Do you want hard-coded strings in your application?', 
        function(btn) {
            return btn === 'yes';
        }
    );
}

In the above function a "callback" function returns a result and not my actual function.
How can I get returnAnswer function return a result?

Thanks in advance.

like image 629
A1rPun Avatar asked Jun 30 '26 20:06

A1rPun


1 Answers

returnAnswer should pass a callback:

function returnAnswer(callback) {
    Ext.Msg.confirm('HardCoded', 'Do you want hard-coded strings in your application?', 
    function(btn) {
       callback.call(this, btn === 'yes');
    });
}
like image 119
CD.. Avatar answered Jul 02 '26 10:07

CD..



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!