0

I've tried to ease my life by using Google Chrome's devtools and as I've tried to modify javascript of page on fly but it seems to behave unexpectedly

I have this function that is called every frame of the game

View.prototype.onHit = function() {
    for(var i = 0; i < this.obstacles.length; i++) {
        if(this.obstacles[i].dealsDamage) {
            //deal damage
        } else {
            //do something else
        }
    }
}

and when I open it on chromes "Sources tab" and pause execution and add something simple such as

console.log("hey");

it starts printing text "hey" on console as expected but the moment i modify some code such as the if check to

        if(!this.obstacles[i].dealsDamage) {
            //do something else
        } else {
            //deal damage
        }

inverting the behaviour and save the document, the code doesnt take effect and the logging source changes to View.js (old)

and anything I change after that doesn't affect the running javascript

Screenshot from console

1 Answer 1

2

The "(old)" script normally should only appear if the more complex changes are applied. Namely, if you change a function parameter number or start (and lamently stop) using a variable from outer scope.

If live edit fails to work in such simple use-case as you describe, it could be a good thing to file to http://crbug.com

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.