Skip to content

Instantly share code, notes, and snippets.

View Luardi's full-sized avatar

Mark Luardi

  • Tel Aviv
View GitHub Profile
@Luardi
Luardi / throttle.js
Last active September 19, 2016 21:57
var throttle = function(func, thottleTimeout) {
var state = null;
var stop = 1;
return function() {
if (state) return;
func.apply(this, arguments);
state = stop;
setTimeout(function() { state = null }, thottleTimeout);
}
}
'use strict';
var template = document.querySelector('template');
var templateContainer = 'content' in template ? template.content : template;
var getPictureElement = function(picture) {
var pictureElement = templateContainer.querySelector('.picture').cloneNode(true);