Skip to content

Instantly share code, notes, and snippets.

Rupesh Mishra happymishra

Block or report user

Report or block happymishra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View throttleEx.html
<html>
<style>
div {
border: 1px solid black;
width: 300px;
height: 200px;
overflow: scroll;
}
</style>
View issueWODeThEx.html
<html>
<body>
<label>Search</label>
<!-- Renders an HTML input box -->
<input type="text" id="search-box">
<p>No of times user actually clicked</p>
<p id='show-api-call-count'></p>
</body>
View debounceEx.html
<html>
<body>
<label>Search</label>
<!-- Renders an HTML input box -->
<input type="text" id="search-box">
<p>No of times user actually clicked</p>
<p id='show-api-call-count'></p>
View clearTimeout.js
function delayFuncExec() {
// This statement will not be printed as it will be cancelled by
// clearTimeout
console.log("I will not be executed as I will be cancelled");
}
var timerId = setTimeout(delayFuncExec, 100)
console.log("Timer Id: " + timerId)
View throttle.html
<html>
<body>
<button id="click-btn">Click me!</button>
</body>
<script>
var timerId;
var clickBtn = document.getElementById('click-btn');
View setInterval.js
function delayFuncExec () {
console.log("I will be called after every 100 milliseconds");
}
var timerId = setInterval(delayFuncExec, 100)
console.log("Timer Id: " + timerId)
View setTimeout.js
function delayFuncExec() {
console.log("I will be called after 100 milliseconds");
}
var timerId = setTimeout(delayFuncExec, 100)
console.log("Timer Id: " + timerId)
View debounce.html
<html>
<body>
<button id="click-btn">Click me!</button>
</body>
<script>
var timerId;
var clickBtn = document.getElementById('click-btn');
var clickFunction = function(){
View issueWithoutDeThro.html
<html>
<body>
<label>Search</label>
<!-- Renders an HTML input box -->
<input type="text" id="search-box" oninput="makeAPICall()">
<!-- Displays number of time makeAPICall method is called -->
<p id='show-api-call-count'></p>
</body>
View share1.html
<!DOCTYPE html>
<html>
<body>
<label for=shared_file>File(s):</label></td>
<input id='share-files' type="file" multiple>
<button id="share-button">Share</button>
</body>
<script src='share.js'></script>
</html>
You can’t perform that action at this time.