Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adding plugin support#9

Closed
cayasso wants to merge 2 commits intotj:masterfrom
cayasso:master
Closed

Adding plugin support#9
cayasso wants to merge 2 commits intotj:masterfrom
cayasso:master

Conversation

@cayasso
Copy link

@cayasso cayasso commented Sep 6, 2014

No description provided.

@Qard
Copy link
Collaborator

Qard commented Sep 6, 2014

I don't really get the purpose of this. It's not hooking into anything to work as a middleware and not doing anything special to make a thing a plugin. It's just sugar for a plugin(actor, args...) call. Why would you want an extra function with the indirection and overhead of adding the slice/apply calls?

@Qard Qard closed this Sep 24, 2014
@cayasso
Copy link
Author

cayasso commented Sep 24, 2014

With a plugin interface its easy for any one to add or build on top of it, for example adding features like reconnect, error handling, etc (We needed these features and added them as plugins). I do think its a plus that will not hurt but bring options for the community to extend. Of course I can use the Actor.on('actor', function(actor){ actor.reconnect = function(){ } }) but I fond it more convenient todo actor.use(function(actor){ actor.reconnect = function(){}}). Yes the slice/apply jazz can be ignored, and it can be simple as:

Actor.prototype.use = function(plugin){
  plugin(this);
  return this;
};

Its ok if you don't want to add it, but I really don't see a reason why not. Anyway is ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants