Comments (4)
What would be the benefit of this, outside a feeling of familiarity for someone used to EventEmitter
?
I'm on the fence about this personally. Adding aliases is relatively easy to do, but they also add unneeded code and potential confusion in my own personal opinion. Totally willing to hear other ideas, or reasons why this helps (i.e. is there code that then becomes drop-in with this lib once we add x, y, or z?)
from ampersand-events.
I'm also +1 on @wraithgar's comment: increasing the api surface area, even if just with aliases, doesn't seem worth it to me without more compelling reasons.
from ampersand-events.
In my case, I've just been switching my Node data structures from mixing in EventEmitter to extending AmpersandState, and being able to drop in (instead of requiring s/emit/trigger
) would be nice.
But yea, I'm split the same way with the potential confusion. It's up to you whether this's worth doing.
from ampersand-events.
It's up to you whether this's worth doing—I'm not even sure if using Ampersand on the server is a use case you support.
Where possible we've made as much of ampersand run in node as possible.
FWIW you could create a base-state.js
in your app, (often in frontend apps you have one of those anyway for various reasons), that looks like:
var State = require('ampersand-state');
var BaseState = State.extend({});
BaseState.prototype.emit = BaseState.prototype.trigger;
//... etc
module.exports = BaseState;
and import that where you want eventemitter like methods and it'll just work:
http://esnextb.in/?gist=2b4714ccfda21e62e5f2
from ampersand-events.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ampersand-events.