Event naming conventions

39 views
Skip to first unread message

Gabriel Pugliese

unread,
Apr 10, 2015, 10:24:59 PM4/10/15
to twitter...@googlegroups.com
Hi,

How would be the best way to name conventions when you have a lot of components and many events being passed through the document? Me and my team are having some bad times at debugging sometimes.

I was thinking that it may be a good idea to prepend the name of the component that is triggering the event, like:

this.on(document, 'dataComposeBoxServed', this.launchComposeBox);

is translated to:

this.on(document, 'data/composeBox:served', this.launchComposeBox);

or something like that.
Would it be good at scale?

Tom Ashworth

unread,
Apr 11, 2015, 5:37:53 AM4/11/15
to Gabriel Pugliese, twitter...@googlegroups.com
Hey Gabriel,

If you can establish at agreed way to do this within your team, I think that would be a valuable thing to do. TweetDeck's never really run into event naming trouble — we just tend to be verbose and descriptive — so I can't talk from experience, but it seems reasonable.

If you're rigorous about it, you might be able to extract some useful information from the event names later, like the event relationships between components (X triggers event A which Y and Z listen to)

--
Tom

Gabriel Pugliese

unread,
Apr 11, 2015, 9:55:41 AM4/11/15
to Tom Ashworth, twitter...@googlegroups.com

Hi Tom,

Thanks for the answer.
I just fear we do it wrong and the whole thing do not scale well.
I'll post results after we refactor the components.

Best,
Gabriel

Reply all
Reply to author
Forward
0 new messages