Using wire/aop config & cola event api

18 views
Skip to first unread message

Ilayaperumal Gopinathan

unread,
Jan 11, 2013, 11:29:08 AM1/11/13
to cuj...@googlegroups.com
Hi,

I have a question related to following config:

From the https://github.com/cujojs/todomvc/blob/master/labs/architecture-examples/cujo/app/main.js

todos: {
create: {
module: 'cola/Hub',
args: {
strategyOptions: {
validator: { module: 'create/validateTodo' }
}
}
},
before: {
add: 'cleanTodo | generateMetadata',
update: 'cleanTodo'
}
}


Here, the todos component has the wire/aop 'before' connection on add and update events.
I would like to know if the following config does the same as above:

todos: {
create: {
module: 'cola/Hub',
args: {
strategyOptions: {
validator: { module: 'create/validateTodo' }
}
}
},
connect: {
beforeAdd: 'cleanTodo | generateMetadata',
beforeUpdate: 'cleanTodo'
}
}

Thanks in advance,
-- Ilaya

unscriptable

unread,
Jan 12, 2013, 1:08:06 AM1/12/13
to cuj...@googlegroups.com
Hello Ilaya,

The "add", "update", etc events happen after adapters are notified of the event. The "beforeAdd", "beforeUpdate", etc events happen before adapters are notified.

If a strategy or connected adapter cancels an event, the advice on the "add", "update", etc events never gets called.  However, the advice on the "beforeAdd", "beforeUpdate" etc advice would always be called.

Does that help?  Sorry for the lack of documentation. :(

-- John
Reply all
Reply to author
Forward
0 new messages