Skip to content

Instantly share code, notes, and snippets.

/**
* ECMAScript 2015 (ES6) - Most Important Features
*
* This file contains small code snippets demonstrating the key features
* introduced in ES2015.
*/
// ============================================================================
// 1. Arrow Functions
// ============================================================================
@yanv1991
yanv1991 / pubsub.js
Created September 16, 2016 06:59 — forked from learncodeacademy/pubsub.js
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {