Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Feb 2010
    Posts
    7
    Vote Rating
    0
    pleszczynski is on a distinguished road

      0  

    Default Ext.Function.createBuffered ignoring arguments

    Ext.Function.createBuffered ignoring arguments


    ExtJS 4.0.7, Firefox 7.0.1.

    Ext.Function.createBuffered function ignores arguments passed to buffered function.
    Example:
    Code:
    fun = function() {
      console.log(arguments);
    }
    fun2 = Ext.Function.createBuffered(fun, 100);
    fun2(1, 2, 3);
    Expected:
    Code:
    [1, 2, 3]
    Got:
    Code:
    [ -12 ]
    Code:
        createBuffered: function(fn, buffer, scope, args) {
            return function(){
                var timerId;
                return function() {
                    var me = this;
                    if (timerId) {
                        clearTimeout(timerId);
                        timerId = null;
                    }
                    var args2 = arguments;
                    timerId = setTimeout(function(){
                        //fn.apply(scope || me, args || arguments); //WRONG
                        fn.apply(scope || me, args || args2); //CORRECT
                    }, buffer);
                };
            }();
        },

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,507
    Vote Rating
    258
    LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of LesJ has much to be proud of

      0  

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,249
    Vote Rating
    690
    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


    Thanks for the report, as @LesJ said, this has been fixed for 4.1.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #4
    Sencha User nextSTEP's Avatar
    Join Date
    Sep 2010
    Posts
    36
    Vote Rating
    0
    nextSTEP is on a distinguished road

      0  

    Default


    Already occurs in 4.02.

Thread Participants: 3