Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Location
    Italy
    Posts
    84
    Answers
    1
    Vote Rating
    4
    Tegola is on a distinguished road

      0  

    Default Unanswered: Save current route url to localStorage

    Unanswered: Save current route url to localStorage


    Hello,
    since the only way to restore the state of a web app added to the iOS homescreen is by using routing, I'm searching for a way to store the current route's hash url to localStorage, so I can load it the next time the user opens the app.

    The easiest way to store the url is:
    Code:
    localStorage.setItem('url', location.hash.substr(1));
    However, I need to save this url everytime the app launches a "redirectTo(...)". I didn't find a specific event or a way to intercept it. How do you do it?

    Thanks

  2. #2
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    Code:
    Ext.define('controller',{
        config:{
            before:{
                showUser:'storeUrl'
            },
            routes:{
                'user/:id': 'showUser'
            }
        },
        storeUrl:function(action){
            localStorage.setItem('url', location.hash.substr(1));
            action.resume();
        }
    })
    I write English by translator.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Location
    Italy
    Posts
    84
    Answers
    1
    Vote Rating
    4
    Tegola is on a distinguished road

      0  

    Default


    Thanks for your reply.

    That means that I need to add a "before" config for every action. There's a clean way to launch it before ANY action?

    Here's my dirty method:

    Code:
    if (Ext.feature.has.History) {
    	window.addEventListener('hashchange', Ext.bind(saveUrl, this));
    }
    
    function saveUrl(location){
    	var hash;
    		
    
    	if (location.hash) { // object
    		hash = location.hash;
    	} else if (location.newURL)  { // hashchange event
    		var anchor = document.createElement('a');
    		anchor.href = location.newURL;
    		hash = anchor.hash;
    		delete anchor;
    	}
    	localStorage.setItem('url', hash.substr(1));
    }

Thread Participants: 1

Tags for this Thread