1. #1
    Sencha User
    Join Date
    Jan 2010
    Posts
    249
    Vote Rating
    16
    existdissolve will become famous soon enough

      0  

    Default Move config.io to Ext.io.Controller?

    Move config.io to Ext.io.Controller?


    As part of my experimentation with Ext.io.Controller, I've created an Authentication controller that simply extends Ext.io.Controller and implements custom methods as necessary. Seems to work just fine.

    At the moment, all of the config for io is set in the main application config. Just a thought, but does it make sense to allow that configuration to be set in the controller itself (or extends of the controller)?

    The following worked for me:

    Code:
    Ext.define('MyApp.controller.Authentication', {
            extend: 'Ext.io.Controller',
            config: {
                io: {
                    logLevel: 'debug',
                    appId: '5udcINurg7MjiKE3wpQwemKhnlS',
                    appSecret: 'Psyp6ttPyBO2W5WU',
                    authOnStartup: false,
                    manualLogin: true
                }   
            }
    })
    And then a slight mod in sencha-io-debug (line 16022, build:0.8.7):

    Code:
    var conf  = this.config.io;
    16123:
    Code:
    auth: function() {
        this.login(!this.config.io.manualLogin);
    }
    Thoughts?

  2. #2
    Sencha - IO Dev Team
    Join Date
    Apr 2011
    Posts
    60
    Vote Rating
    3
    jason.cline is on a distinguished road

      0  

    Default


    Thanks for the feedback. We could build the controller this way where the developer extends Controller like they do Stores and add their configuration and extensions. We will explore this as we continue to refine the API.

    The main reason why the config is part of the application at the moment is because you can only have one sencha.io application configured and running at a time. If the config is part of the controller then someone might be tempted to have two controllers in the same application with different configs which at the moment would cause problems.

  3. #3
    Sencha User
    Join Date
    Jan 2010
    Posts
    249
    Vote Rating
    16
    existdissolve will become famous soon enough

      0  

    Default


    Ah, that makes sense. Thanks!