node add/remove hooks

Is there a way to hook into a concept so that some code of mine gets called for every node added to/removed from a role?
It's basically about keeping a same but different node up to date.
I'm hooking into a few places like the element factory but I probably haven't caught all possible vectors and if I've missed a simpler way to track this ... thanks.
0
2 comments
Nope. It is hard to implement, because the hook may be invoked in any context. If your hook creates another element, which may trigger another hook, it is a potential endless loop. Hooks being invoked in the middle may affect the original AST transformation (like refactoring or action/intention code). It is also unclear how to handle nodes without a model (just created).

I'm not sure you'll ever be able to catch all the places. I would try to:

a) use derived properties (constraints aspect)
b) invent a higher level language without redundancy, reduce it into the current one
c) create a typesystem rule to check data consistency (with some editor-specific hooks)
0
I see.
For now I can live with some minor sync issues, but I'll check those options.
Thanks.
0

Please sign in to leave a comment.