Skip to content

Instantly share code, notes, and snippets.

View bjfletcher's full-sized avatar

Ben Fletcher bjfletcher

View GitHub Profile
@thebeebs
thebeebs / AsyncExample.js
Last active September 15, 2020 19:41
An example of using Async Await to create some text in a guaranteed order.
// Calling the function using promises.
addElement("first promise sexy syntax")
.then(x => addElement("second promise syntax"))
.then(x => addElement("third promise syntax"))
.then(x => addElement("fourth promise syntax"))
// Calling the function using Async/Await
async function myFunction(){
await addElement("first async");
await addElement("second async");
@jonathantneal
jonathantneal / README.md
Created September 19, 2012 06:34
Polyfill the EventListener interface in IE8

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.