Ah, OK. Thank you Derrell.

Then I have to use something else to make this work.

I need a mechanism which initializes some class specific static hash within the mixin, depending on the class the mixin is included to. After initialization of the hash, which is finished after the first instantiation of the class, the hash should be used by any subsequent instance.
But the hash has to be specific to that class.

One possibility would be to have a hash of hashes within the mixin, which is specific to the class where the mixin is included to. But this assumes that the mixin is capable of retrieving the class to which it is mixed in.



Am 23.12.2015 um 16:08 schrieb Derrell Lipman:
No, sorry, singleton is the opposite of what you want. Just some other regular class.

Derrell


On Wed, Dec 23, 2015 at 10:07 AM Derrell Lipman <derrell.lip...@unwireduniverse.com <mailto:derrell.lip...@unwireduniverse.com>> wrote:

    I don't think you can do that. The static is part of the mixin,
    it's not per whatever it's mixed in to. Maybe you want to create a
    singleton class to do that?

    Derrell


    On Wed, Dec 23, 2015 at 10:03 AM Dietrich Streifert
    <dietrich.streif...@googlemail.com
    <mailto:dietrich.streif...@googlemail.com>> wrote:

        Hi Derrell,

        but I want myhash to be specific to the class where the mixin
        is mixed in.

        So if I mixin to myapp.A and also to myapp.B the myhash static
        should be different for each class A and B.


        Am 23.12.2015 um 15:58 schrieb Derrell Lipman:
        Static members are accessed in exactly the same way
        regardless of whether they're in a mixin or not. In this
        case, you'd access "myapp.MMixin.myhash" because myhash is a
        static of the mixin itself.

        Derrell


        On Wed, Dec 23, 2015 at 9:52 AM Dietrich Streifert
        <dietrich.streif...@googlemail.com
        <mailto:dietrich.streif...@googlemail.com>> wrote:

            Hi all,

            if I have a mixin like this:

            qx.Mixin.define("myapp.MMixin",
            {
              statics : {
                myhash: {}
              },

              members: {
                mymethod : function() {
                   this.self(arguments).myhash.foo = 'bar'; // this
            does not work !!!!

                   this.constructor.myhash.foo = 'bar'; // this does
            not work !!!!
                }
              }
            });

            How do I access the static member myhash? The code above
            does not work!

            The mixin is of course used via include in another class.

            Any help would be great!

            Regards
            Dietrich



------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to