Search code examples
extjssencha-touch

How to maintain user state in ext JS?


I am trying to maintain user state in ext JS application, like we use session. I want to maintain user state in my Ext JS/Sencha apllication. How I do.? I want to keep UserId which i want to access globally in my application.


Solution

  • Ext.define('UserInfo',{
        singelton: true,
        userInfo: {},
        setUserInfor: function(data){
           this.userInfo = data;
        },
        getUserInfo: function(){
         return this.userInfo;
        }
    })
    

    UserInfo class can be access accross the application.