Skip to content

Instantly share code, notes, and snippets.

View adrianvlupu's full-sized avatar
💾
the world

Victor Lupu adrianvlupu

💾
the world
  • Fullscreen Digital
  • Bucharest Romania
View GitHub Profile
@adrianvlupu
adrianvlupu / handler-react-2.js
Created October 20, 2016 16:01 — forked from machnicki/handler-react-2.js
Event handlers in React - 2
import React, { Component } from 'react'
import { MyInput, MyAnotherInput } from 'myInputs'
class MyComponent extends Component {
handleChange = (e) => e.preventDefault()
handleClick = (e) => e.preventDefault()
handleKeyPress = (e) => {
e.preventDefault()
@adrianvlupu
adrianvlupu / es6-eventemitter.js
Created October 11, 2016 14:06 — forked from datchley/es6-eventemitter.js
A straight forward EventEmitter implemented in Javascript using ES6
let isFunction = function(obj) {
return typeof obj == 'function' || false;
};
class EventEmitter {
constructor() {
this.listeners = new Map();
}
addListener(label, callback) {
this.listeners.has(label) || this.listeners.set(label, []);