localStorage causing app to come to a crawl

Hello

I am using $window.localStorage to store session & refresh tokens.

If i include my localStorage code in my Ionic project then the username & password inputs on my login screen lag alot.

The best way i can describe it is, a few seconds after i click either the username or password input boxes the app stops rendering frames, so if i keep typing after it freezes and then i click the input box again, my input suddenly appears as if the app continues rendering frames but then stops rendering after afew seconds again.
I find the app stops rendering when the “keyboard-open” class is added to the input box.

The only thing i need to do to fix the problem is to remove references to my localStorage code from my app or simply delete the below code from the javascript file it is contained in.

This is both happening when i am testing the app using chrome with a webserver or when i use a android emulator.

Has anyone had similar problems? Anything i could try?

Here is my localStorage code.

 .factory('$localstorage', ['$window', function ($window) {
    return {
        set: function (key, value) {
            $window.localStorage[key] = value;
        },
        get: function (key, defaultValue) {
            return $window.localStorage[key] || defaultValue;
        },
        remove: function (key) {
            return $window.localStorage.removeItem(key);
        },
        setObject: function (key, value) {
            $window.localStorage[key] = JSON.stringify(value);
        },
        getObject: function (key) {
            return JSON.parse($window.localStorage[key] || '{}');
        }
    }
}])

I never had any problems with localStorage but i stopped using it because of the storage limitation compared to using mozilla’s localForage https://github.com/mozilla/localForage