-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome's console value preview functionality spams the console commands #140
Comments
Oh that is interesting! I can reproduce it easily. I am less sure how to fix it. But I will definitely look into this for this year. |
Could you do something like replacing var say = function(){
emit('chat', {message: message});
}
say.toString = function(){
say(prompt("What do you want to say?"));
return " ";
} with Object.defineProperty(window,'say',{
value:function(){
emit('chat', {message: message});
},
get:function(){
this(prompt("What do you want to say?"));
}
}) Because Chrome is a lot more careful about firing getters and setters |
Hmm, this looks promising, though is new syntax to me. But I tried adapting the code to use it, and got this error:
That's with this code: Object.defineProperty(window,'say',{
value:function(){
if (!message) return;
if (user.live.chat != "true") return;
message = message.toString();
said = true;
emit('chat', {message: message});
return blank();
},
// run without parens to use a popup dialog
get:function(){
this(prompt("What do you want to say?"));
return " ";
}
}) |
For now, I've updated the site to remove all of the |
Chrome recently added a value preview to their auto-completion.
So when typing the word
help
it auto-completes the word. And trying to preview the resulting value. Which calls the.toString
method, spamming that function every-time you try to finish typinghelp
Is it possible detect who is calling the function, or use getters to only run the
.toString
function once enter is pressed?The text was updated successfully, but these errors were encountered: