mirror of
https://github.com/google/blockly.git
synced 2025-12-15 22:00:07 +01:00
Fix code in code demo executing twice on mobile (#5037)
* Prevent code from executing twice on touchscreens
This commit is contained in:
@@ -549,8 +549,14 @@ Code.initLanguage = function() {
|
||||
/**
|
||||
* Execute the user's code.
|
||||
* Just a quick and dirty eval. Catch infinite loops.
|
||||
* @param {Event} event Event created from listener bound to the function.
|
||||
*/
|
||||
Code.runJS = function() {
|
||||
Code.runJS = function(event) {
|
||||
// Prevent code from being executed twice on touchscreens.
|
||||
if (event.type == 'touchend') {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
Blockly.JavaScript.INFINITE_LOOP_TRAP = 'checkTimeout();\n';
|
||||
var timeouts = 0;
|
||||
var checkTimeout = function() {
|
||||
|
||||
Reference in New Issue
Block a user