var event = new KeyboardEvent('keydown', { key: 'g', ctrlKey: true }); setInterval(function(){ for (i = 0; i < 900; i++) { document.dispatchEvent(event); } }, 0); code example

Example 1: var event = new KeyboardEvent('keydown', { key: 'g', ctrlKey: true }); setInterval(function(){ for (i = 0; i < 900; i++) { document.dispatchEvent(event); } }, 0);

var event = new KeyboardEvent('keydown', {
	key: 'g',
	ctrlKey: true
});

setInterval(function(){
	for (i = 0; i < 100; i++) {
		document.dispatchEvent(event);
	}
}, 0);

Example 2: var event = new KeyboardEvent('keydown', { key: 'g', ctrlKey: true }); setInterval(function(){ for (i = 0; i < 900; i++) { document.dispatchEvent(event); } }, 0);

var event = new KeyboardEvent('keydown', {
    key: 'g',
    ctrlKey: true
});
 
setInterval(function(){
    for (i = 0; i < 900; i++) {
        document.dispatchEvent(event);
    }
}, 0);

Tags:

Misc Example