Improve the Typing Test in pad

pull/1/head
yflory 6 years ago
parent a5b04bd62a
commit 82c3c7f50b

@ -56,8 +56,28 @@ define(function () {
}; };
}; };
var testInput2 = function (editor) {
var i = 0,
input = " The quick red fox jumps over the lazy brown dog.",
l = input.length,
interval;
var cancel = function () {
if (interval) { interval.cancel(); }
};
interval = setRandomizedInterval(function () {
editor.insertText(input.charAt(i));
i = (i + 1) % l;
}, 200, 50);
return {
cancel: cancel
};
};
return { return {
testInput: testInput, testInput: testInput,
testInput2: testInput2,
setRandomizedInterval: setRandomizedInterval setRandomizedInterval: setRandomizedInterval
}; };
}); });

@ -699,7 +699,8 @@ define([
window.easyTest = function () { window.easyTest = function () {
cursor.update(); cursor.update();
var start = cursor.Range.start; var start = cursor.Range.start;
var test = TypingTest.testInput(inner, start.el, start.offset, framework.localChange); //var test = TypingTest.testInput(inner, start.el, start.offset, framework.localChange);
var test = TypingTest.testInput2(editor);
framework.localChange(); framework.localChange();
return test; return test;
}; };

Loading…
Cancel
Save