Hi,
I recently thought about if it would be useful to
have pre- and postfunctions in FlowScript which are
excecuted before and after a normal flow-function.
The reason was that we needed some components in
every flow-function and it was not so nice to get
and release the components in each functions.
Something like this:
flow.js:
var comp1;
var comp2;
function preFunc() {
comp1 = cocoon.getComponent("comp1");
comp2 = cocoon.getComponent("comp2");
}
function myFlowFunction1() {
comp1.doSomething();
comp2.doSomething();
}
function myFlowFunction2() {
comp1.doIt();
comp2.soIt();
}
function postFunc() {
cocoon.releaseComponent(comp1);
cocoon.releaseComponent(comp2);
}
sitemap:
<map:match pattern="*">
<map:call function="{1}">
<map:parameter name="preFunction" value="preFunc"/>
<map:parameter name="postFunction" value="postFunc"/>
</map:call>
</map:match>
This would call:
preFunc();
myFlowFunction();
postFunc();
I was wondering if it would be safe to use the 'global' vars
comp1 and comp2 e.g. if a user has tow parallel requests
(race conditions?)?
This is just a basic thought and I'm not sure if it causes
more problems than it solves. :-)
WDYT?
Freundliche Gr��e / With kind regards
Jens Maukisch
--
S&N AG
Competence Center Open Source
Klingenderstr. 5
D 33100 Paderborn