Skip to content

shake event not firing state change after state change shake is working in ionic can you please help me #28

Description

@mganigapeta

this is my code:

if(!$window.localStorage.Shakecount){
$window.localStorage.setItem('Shakecount', 1);
}
if(!$window.localStorage.themecolor){
$window.localStorage.setItem('themecolor', "awesome_blue");
}

$scope.themecolor = $window.localStorage.getItem("themecolor");
var indexcount = $window.localStorage.getItem("Shakecount");



var onShake =  function() {
    alert("afterloadedok");
    switch(indexcount){
        case "1":
            var index = parseInt(indexcount) + 1;
            $scope.themecolor = "royal_pink";
            alert(index);
            alert($scope.themecolor);
            $window.localStorage.setItem('Shakecount', index);
            $window.localStorage.setItem('themecolor', $scope.themecolor);
            shake.stopWatch();
            $window.location.reload();
            break;
        case "2":
            var index = 1;
            $scope.themecolor = "awesome_blue";
            alert(index);
            alert($scope.themecolor);
            $window.localStorage.setItem('Shakecount', index);
            $window.localStorage.setItem('themecolor', $scope.themecolor);
            shake.stopWatch();
            $window.location.reload();
            break;

        default:
            index = 1;
            $scope.themecolor = "awesome_blue";
            alert(indexcount);
            alert($scope.themecolor);
            $window.localStorage.setItem('Shakecount', index);
            $window.localStorage.setItem('themecolor', $scope.themecolor);
            shake.stopWatch();
            $window.location.reload();
            break;
    }
}

if(window.shake) shake.startWatch(onShake,40);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions