facebookarchive / emitter Goto Github PK
View Code? Open in Web Editor NEWA JS EventEmitter foundation for evented code
License: Other
A JS EventEmitter foundation for evented code
License: Other
We have some updates to get out. cc @fisherwebdev
Hi, can you add API for handling all events like a
emmiterNamespace.addListener('*', () => {...});
Right now it relies on a very old version of fbjs.
What we have is basically copied from React 2 years ago. We have some upgrades there that should make their way here.
Just use jest.
We already do that now, but we still have a bunch of code in there to use phantomjs via grunt.
We don't right now but we probably should. That way Flux can make use of this instead of the node emitter.
bin
srequire('fbemitter')
gives you what?)Bump the version since a few things changed
Suppose I have the following code:
electron_1.app.once('open-file', function (e, p) {
process.argv.push(p);
e.preventDefault();
});
electron_1.app.once('open-file', function (e, p) {
// log the event
console.log('open ' + p);
e.preventDefault();
});
Only one of the events will be received. Is it the expected behavior?
Since we don't have a website (nor do I think we need to have one) we need to document the full API somewhere. Readme is an easy place. You could also use the wiki.
The dependencies cause babel 5.8.x to be included which breaks react-native .
Please fix this.
react packager
Error: Naming collision detected: /Users/roku/Documents/r/on/node_modules/react-native/node_modules/fbjs/lib/camelize.js collides with /Users/roku/Documents/r/on/node_modules/fbemitter/node_modules/fbjs/lib/camelize.js
at HasteMap._updateHasteMap (HasteMap.js:132:13)
at HasteMap.js:103:28
at tryCallOne (/Users/roku/Documents/r/on/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/roku/Documents/r/on/node_modules/react-native/node_modules/promise/lib/core.js:123:15
at flush (/Users/roku/Documents/r/on/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)
~
i am using
"react-native": "^0.18.0-rc",
"fbemitter": "2.0.1",
Hi, this is really a "just curious" question! I remember reading about this project in the spring and one thing that really stood out was "event validation", the way you could whitelist events upfront to cause loud failures if the emitter was misused later on.
But, it seems like that feature has been removed. Why did you decide to remove it? Was it less helpful in practice than on paper? Or did it have unintended consequences?
https://github.com/facebook/emitter/blob/master/src/EmitterSubscription.js#L32
there is no validation on the param listener
constructor(subscriber: EventSubscriptionVendor, listener, context: ?Object) { super(subscriber); this.listener = listener; this.context = context; }
and no appliable
check when apply the listener.
https://github.com/facebook/emitter/blob/master/src/BaseEventEmitter.js#L182
__emitToSubscription(subscription, eventType) { var args = Array.prototype.slice.call(arguments, 2); subscription.listener.apply(subscription.context, args); }
can we add some checks or make some noises when create a new EmitterSubscription?
This example has a typo in it:
var emitter = new EventEmitter();
emitter.addListener('event', function(x, y) { console.log(x, y); }
emitter.emit('event', 5, 10); // Listener prints "5 10".
The second line should read
emitter.addListener('event', function(x, y) { console.log(x, y); });
I'm trying to load the module using ES6 with babelify.
I get the error:
Cannot find module './lib/BaseEventEmitter' from ...
I install the module using npm
I load the module like this:
import {EventEmitter} from 'fbemitter';
I see in package.js, that it points main to index.js. And index.js require('./lib/BaseEventEmitter')
.
The lib
directory is not present. May be it should say src
?
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.