Versioning Infusion
Colin Clark
colin.clark at utoronto.ca
Fri Sep 19 21:20:05 UTC 2008
Hi everyone,
I'm digging into my last remaining task for 0.5: adding versioning
support to Fluid Infusion. This will allow multiple versions of our
JavaScript code to be loaded into the browser simultaneously, without
causing conflicts.
Most JavaScript libraries suffer in portal or mashup environments. If
two portlets require conflicting versions of the same library, things
tend to break randomly. Since JavaScript gives us no modules or
linker, we had to come up with a simple strategy based on the use of
closures.
Here's a document that describes the process:
http://wiki.fluidproject.org/display/fluid/Versioning+the+Fluid+Framework
Component developers will get this versioning support nearly for free
if the use the pattern outlined here:
http://wiki.fluidproject.org/display/fluid/How+to+Define+a+Unit
When we tried to implement this feature for Infusion 0.4, we ran into
one show stopper: our invokeGlobalFunction() approach--which allows
for declarative function calling--leaked out of the closure scope,
causing errors. I'll be modifying invokeGlobalFunction() so that it
takes the current fluid variable as an argument. Here's an example:
(function (fluid) {
invokeGlobalFunction("fluid.helloWorld", {
fluid: fluid
});
}) (fluid_05);
Generally, only internal Infusion code will ever call
invokeGlobalFunction, so this added argument won't affect component
authors or users.
As always, feedback is appreciated,
Colin
---
Colin Clark
Technical Lead, Fluid Project
Adaptive Technology Resource Centre, University of Toronto
http://fluidproject.org