jfusco / es6-event-emitter Goto Github PK
View Code? Open in Web Editor NEWCustom, simple, extendable event/messaging system written in ES6
License: MIT License
Custom, simple, extendable event/messaging system written in ES6
License: MIT License
I'm trying to use this with react-native and ran into it trying to run the .bablerc
file from within node_modules. It blows up because of the plugin not being present. Apparently, the convention is becoming not to ship the .bablerc
in the npm package by adding it to .npmignore
.
Are you onboard with that?
Hi there, would it be possible to also introduce a new "once" listener?
Hello,
I'm wondering if it's possible to trigger an event on the constructor, or a method that is called immediately after the class is instantiated.
I'm trying to do something like this;
class Bla extends Emitter {
constructor() {
super()
this.trigger('bla:initialised')
}
}
I notice this event doesn't fire, probably because it hasn't fully loaded or something. How would you do something like this?
Cheers
Hi there, your class looks promising! I am having problems, while trying it out: The compiler says this:
Error: Cannot find module 'babel-runtime/helpers/classCallCheck' from 'node_modules/es6-event-emitter/dist'
Any ideas what I should do about that?
Attempting to use es6-event-emitter
without babel-runtime
as a direct dependency results in this error:
module.js:327
throw err;
^
Error: Cannot find module 'babel-runtime/helpers/classCallCheck'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/pwagener/Devel/callbacks/node_modules/es6-event-emitter/dist/emitter.js:7:24)
at Module._compile (module.js:409:26)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/pwagener/Devel/callbacks/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
...
Adding babel-runtime
as a direct dependency of my project seems to resolve it.
Do you have a specific reason to lock your package to >=7.7.0 <=8.1.x
?
TIA
The fix for #3 is that the package needs to be updated in NPM. If you look in dist:
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _weakMap = require('babel-runtime/core-js/weak-map');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.