Skip to content

Instantly share code, notes, and snippets.

Avatar

Bran van der Meer branneman

View GitHub Profile
View prefixEventListener.js
/**
* Capitalize
*/
const capitalize = string => {
return string.charAt(0).toUpperCase() + string.slice(1);
};
/**
* Prefix EventListener
*/
@branneman
branneman / Observer.js
Created Sep 5, 2016 — forked from peeke/observer.js
Used for inter-object communication. (Semi-)drop in replacement for Rik Schennink's Observer.
View Observer.js
/**
* Used for inter-object communication.
* (Semi-)drop in replacement for Rik Schennink's Observer.
*
* Implementation differences:
* - ES6
* - The use of WeakMaps
* - inform() and conceal() don't return a boolean indicating success.
* - Subscription fn's are called with seperate arguments, instead of one data parameter. This is backwards compatible.
*
View tiny Promise.js
// (c) copyright unscriptable.com / John Hann
// License MIT
// For more robust promises, see https://github.com/briancavalier/when.js.
function Promise () {
this._thens = [];
}
Promise.prototype = {
You can’t perform that action at this time.