This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//There are a lot of image preloaders out there | |
// This one is supposed to be forgiving | |
// depends on Emmitter https://github.com/JFusco/es6-event-emitter | |
class Preloader extends Emitter { | |
constructor(pathList, options) { | |
super(); | |
this.defaults = { | |
prefix: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>WebWorker image preloading</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" /> | |
</head> | |
<body> | |
<div id="output"></div> | |
<script id="imgloader" type="javascript/worker"> | |
// Not race proof or robust. Proof of concept. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//set event on documnet but fire if target is true | |
document.addEventListener('click', function(e) { | |
var clsList = Array.prototype.slice.call(e.target.classList); | |
if(cls.indexOf('hero-heading') > -1) { | |
console.log('hello'); | |
} | |
}) | |
function cssAnimationEvent(element, type, callback) { |