1. #1
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    12
    Vote Rating
    0
    chris is on a distinguished road

      0  

    Default Is it possible to alias mixins?

    Is it possible to alias mixins?


    Hi All,

    I'm working on a project to allow remote updates of the Ext.data.Model class based from a node.js server running Ext. I've extended the Ext.util.Observable mixin into two classes: Subscriber and Publisher.

    I've defined a separate model class that would mixin the Publisher or Subscriber class based on where it's running (e.g. Publisher on the server, Subscriber on the client).

    The goal is to have the Model class not really care or be aware about which mixin it's using. This way I can swap in the behavior I need based on whether we're on the server or client, and use the same Model class for both.

    So, I'm trying to alias the mixin, e.g.

    Code:
    Ext.define("my.Model",
    {
        extend: "Ext.data.Model",
    
        mixins: 
        {
            observable: "my.Observable"
        }
    });
    And swap in the behavior based on whether I'm running on the server or the client, e.g.:

    Code:
    if (inServerEnv === true)
    {
        Ext.ClassManager.setAlias("my.Observable", "my.observable.Publisher");
    }
    else
    {
        Ext.ClassManager.setAlias("my.Observable", "my.observable.Subscriber");
    }
    But alias doesn't seem to work for mixins. Ideally I'd like the models to be (somewhat) independent of their publisher or subscriber behaviors. Any thoughts or recommendations?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What's wrong with using class name?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar