Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Message Event Custom Data #215

Closed
maennchen opened this issue Jan 19, 2014 · 7 comments
Closed

Message Event Custom Data #215

maennchen opened this issue Jan 19, 2014 · 7 comments
Assignees
Labels
Milestone

Comments

@maennchen
Copy link

It would be nice to have a possibility to add custom data to the candy:view.message.before-show Event and then receive this in candy:view.message.after-show.

This would give the possibility to let plugins change the event data and handle them on after-show in a notifications-plugin for example.

@maennchen
Copy link
Author

PS: I'd like to let the modifyme plugin add a custom parameter indicating it's a message which is for me and handle this different from normal messages in the notifications plugin.

@mweibel
Copy link
Member

mweibel commented Jan 19, 2014

This could be achieved by restructuring the event handling a bit (this might required to change the plugins a bit, sadly).
As I started implementing the new event system, I didn't know that a callback can actually return something and this will be given back to the trigger of the event. Therefore we could, instead of doing something strange with the events, just use the return value of the trigger.

This however, would require also that the plugin authors are aware that they need to return the event params again. Don't know if that's a good solution.

@maennchen
Copy link
Author

Can't we just do this:

$(Candy).on('candy:view.message.before-show', function(event, args) {
    args.mCustomKey = 'myCustomValue';
});

@maennchen
Copy link
Author

Have a look at my fiddle ;-)

http://jsfiddle.net/W5Cpt/

I think this way the plugins have nothing to change...

@ghost ghost assigned mweibel Jan 22, 2014
mweibel added a commit that referenced this issue Jan 23, 2014
In case there's a need for other hooks, please
open a new issue or reopen #215.
@mweibel mweibel closed this as completed Jan 23, 2014
@maennchen
Copy link
Author

Thx, now I can make some improvements on the notification plugins.

@mweibel
Copy link
Member

mweibel commented Jan 23, 2014

Maybe first based in the dev branch of the plugins repo until 1.6.1 is release

On Thu, Jan 23, 2014 at 7:01 PM, Jonatan Männchen
[email protected] wrote:

Thx, now I can make some improvements on the notification plugins.

Reply to this email directly or view it on GitHub:
#215 (comment)

@maennchen
Copy link
Author

Have a look at candy-chat/candy-plugins#75 :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants