Skip to content

Instantly share code, notes, and snippets.

@aboutlo
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aboutlo/6ca980ccadeccc32bfd8 to your computer and use it in GitHub Desktop.
Save aboutlo/6ca980ccadeccc32bfd8 to your computer and use it in GitHub Desktop.
es6 example
'use strict';
import _ from 'underscore'; // _ is white
import { EventEmitter } from 'events'; // EventeEmitter is white
import logger from 'loglevel'; // logger is white
let emitter = new EventEmitter();
var Foo = function () {
};
_.extend(Foo.prototype, {
send(method, data) { // send is white
emitter.emit(method);
this.bar(data); // bar is blue
},
on(event, callback) { // on is white
emitter.on(event,callback);
// DO STUFF
},
bar(data) { // bar is white
// DO STUFF
}
});
export default Foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment