sandbox.events.say({
event: "drop",
data: {
"id": 3,
"coordinates": {
"x": 25,
"y": 69
},
target: 'icon'
}
})
I'd say you should use a single verb as event.
If your event's name starts looking like a sentence, keep the verb and
move the rest to the data as properties.
On Sun, Aug 21, 2011 at 9:10 AM, manakor <[email protected]> wrote:
> Hi guys,
> Recently I have build a sample JS Architecture (inspired by N. Zakas
> presentation on Yahoo) to my project, which contains single
> encapsulated modules (based in JS module pattern). Each module has
> limited knowledge about himself, but he is able to throw
> notifications, which could be read by other modules.
>
> I started to work on the project, creating modules and trying to make
> solid communication between them. I have around 10 modules already.
> But when I reached module 10, I realized that there's a mess in naming
> events which modules throws to make communications:
>
> sandbox.events.say({
> event: "drop icon",
> data: {
> "id": 3,
> "coordinates": {
> "x": 25,
> "y": 69
> }
> }
> })
>
> Therefore, I wished to ask to you if you have experience in naming
> those events more properly? I would love to have semantic event names,
> which could always get me a key (even I forgot what's this is event is
> about), what does it really say. Do you think event names has to be
> related to a module, which throws the event, or to modules, which are
> going to read that event?!
>
> Would really appreciate your minds here…
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]