Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    1
    Vote Rating
    0
    gloria.gu@hp.com is on a distinguished road

      0  

    Default Unanswered: How can I get fireEvent to wait for the event to return value

    Unanswered: How can I get fireEvent to wait for the event to return value


    I have the following code in my view:

    isValid : function(){
    var retValue = this.fireEvent("checkValidSave");
    return retValue;
    }

    The checkValidSave event handler will call the method saveSettings in controller. saveSettings will return true or false based on whether or not it saves successfully.

    The problem is when fireEvent calls , it fires event , but it returns immediately while the event is still in progress.


    Based fireEvent description in sencha doc, regarding return ....

    Returns
    • Booleanreturns false if any of the handlers return false otherwise it returns true.
    How to make the fireEvent to wait for the even handler to finish and return proper value?


    Gloria Gu

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,781
    Answers
    356
    Vote Rating
    167
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    I tried abstracted your example and it looks like the response from fireEvent is being captured. If I return false then the result of calling fireEvent is false. If I return true it's true.

    Code:
    var listener = new Ext.util.Observable({
        listeners: {
            checkValidSave: function () {
                //return true;
                return false;
            }
        }
    });
    
    
    Ext.widget('button', {
        renderTo: document.body,
        text: 'Fire Event',
        handler: function (btn) {
            var saved = listener.fireEvent('checkValidSave', btn);
            console.log(saved);
        }
    });
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha User
    Join Date
    Jan 2008
    Location
    Los Angeles
    Posts
    149
    Answers
    1
    Vote Rating
    1
    radtad is on a distinguished road

      0  

    Default


    Quote Originally Posted by slemmon View Post
    I tried abstracted your example and it looks like the response from fireEvent is being captured. If I return false then the result of calling fireEvent is false. If I return true it's true.

    Code:
    var listener = new Ext.util.Observable({
        listeners: {
            checkValidSave: function () {
                //return true;
                return false;
            }
        }
    });
    
    
    Ext.widget('button', {
        renderTo: document.body,
        text: 'Fire Event',
        handler: function (btn) {
            var saved = listener.fireEvent('checkValidSave', btn);
            console.log(saved);
        }
    });
    This works, but it returns right away if there is a buffer which it shouldn't do. Any way around this? It should probably at the least block on the buffering right?

    Code:
        var listener = new Ext.util.Observable({
            listeners: {
                checkValidSave: {
                    fn: function () {
                        //return true;
                        return false;
                    },
                    buffer: 2000
                }
            }
        });
    
    
    
    
        Ext.widget('button', {
            renderTo: 'grid',
            text: 'Fire Event',
            handler: function (btn) {
                var saved = listener.fireEvent('checkValidSave', btn);
                console.log(saved);
            }
        });

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,616
    Answers
    426
    Vote Rating
    580
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    No, because buffering works with setTimeout, there's no way to "block" the thread. You'd need to pass some kind of callback that it could execute.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Jan 2008
    Location
    Los Angeles
    Posts
    149
    Answers
    1
    Vote Rating
    1
    radtad is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    No, because buffering works with setTimeout, there's no way to "block" the thread. You'd need to pass some kind of callback that it could execute.
    Figured as much. I'm writing a base controller to fire an event and do validation within it like this. Other employees will be writing controllers that will be listening to a custom event fired within the base controller (application fireEvent) and I'm just worried someone will put a buffer on the listener for the custom event and screw everything up.

    Is there anyway to tell the listener upon firing the event to not use its buffer if it has one?

Thread Participants: 3

Tags for this Thread