Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

dagalti

🎯
Focusing
Block or report user

Report or block dagalti

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
@LucasIron
LucasIron / debounce_throttle.js
Last active Feb 18, 2019
Debounce & Throttle
View debounce_throttle.js
debounce = (delay, cancel) => (listener, wait) => {
let delayId
return function(...args) {
cancel(delayId)
return delayId = delay(() => listener.apply(this, args), wait)
}
}
debounceTimeout = debounce(setTimeout, clearTimeout)
debounceAnimationFrame = debounce(requestAnimationFrame, cancelAnimationFrame)
@TalAter
TalAter / idb.js
Created Sep 13, 2016
IndexedDB upgrade code to add index to an existing object store
View idb.js
request.onupgradeneeded = function(event) {
var db = event.target.result;
var upgradeTransaction = event.target.transaction;
var objectStore;
if (!db.objectStoreNames.contains("my-store")) {
objectStore = db.createObjectStore("my-store");
} else {
objectStore = upgradeTransaction.objectStore('my-store');
}
You can’t perform that action at this time.