Results 1 to 5 of 5

Thread: [2.1] Ext.util.MixedCollection::allowFunctions

  1. #1
    Ext User Starfall's Avatar
    Join Date
    Jan 2008
    Location
    Moscow, Russian Federation
    Posts
    158
    Vote Rating
    0
      0  

    Default [2.1] Ext.util.MixedCollection::allowFunctions

    Code:
    this.allowFunctions = allowFunctions === true;
    Is it really needed to restrict allowFunctions to boolean datatype? What if my call to Ext.util.MixedCollection constructor has a statement in place of allowFunctions argument which returns 0 or 1? Surely, I can convert it to boolean, but that's unnecessary code.

  2. #2
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    going by that argument, there'd be much more than a handful of places where the strict boolean type check has to be relaxed.

    how troublesome is it to do a double inverse truth?

    Code:
    var coln = new Ext.util.MixedCollection(!!checkIfFunctionsAreAllowed(), someKeyFn);

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,583
    Vote Rating
    873
      0  

    Default

    We could introduce new methods:

    isTruthy, isTrue
    Evan Trimboli
    Twitter - @evantrimboli

  4. #4
    Ext User Starfall's Avatar
    Join Date
    Jan 2008
    Location
    Moscow, Russian Federation
    Posts
    158
    Vote Rating
    0
      0  

    Default

    Why not relax it? Your code becomes smaller, my code becomes smaller, everybody's happy taking advantage of JS type conversion

  5. #5
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
      0  

    Question cannot set allowFunctions to true

    var cs = Ext.create('Ext.draw.CompositeSprite', {allowFunctions: true});
    cs.allowFunctions; // returns false... why?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •