Skip to content

Instantly share code, notes, and snippets.

@luiscastro193
luiscastro193 / pause.js
Created November 21, 2019 13:06
Pause promise
"use strict";
function pause(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@luiscastro193
luiscastro193 / selectInput.js
Last active March 23, 2019 17:17
Select input (JavaScript)
"use strict";
function selectInput(input) {
setTimeout(function() {
try {
input.setSelectionRange(0, input.value.length);
}
catch(e) {
input.select();
}
}, 0);