Results 1 to 4 of 4

Thread: Reference static in static

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Location
    Ljubljana
    Posts
    23
    Vote Rating
    0
      0  

    Default Reference static in static

    I tried this, self, Class name.

    Example:

    statics: {
    A: 'something',
    B: className.A
    }

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    21
    Answers
    2
    Vote Rating
    2
      0  

    Default

    How about this.self?

    EDIT: Sorry, slightly misunderstood the question. You're right, there seems to be no way of doing this because there is no object to work with at the time when the statics are evaluated. You can reference static variables in static functions though, maybe that helps:

    Code:
    statics : {
            A : 'something',
            B : function() { return this.A; }
    }
    and then later

    Code:
    console.log(My.cool.Class.B());

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
      1  

    Default

    Code:
    Ext.define('MyClass',{
        statics: (function(){
            var str="something";
            return {
                A: str,
                B: str
            };
        })()
    })
    I write English by translator.

  4. #4
    Sencha User
    Join Date
    Aug 2012
    Posts
    21
    Answers
    2
    Vote Rating
    2
      0  

    Default

    Well, I guess there is a way to do this after all.

    Nice one haduki

Tags for this Thread

Posting Permissions

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