Jingo assembler

1 view
Skip to first unread message

BreweR

unread,
Oct 28, 2009, 3:50:43 PM10/28/09
to Jingo Users
Hi,

Just wondering if anyone has crossed this bridge before.
How do you flag a dynamic module so the build assembler will skip a
particular module that we can only determine during runtime?
Example code snippet - of course the package structure, etc are
assumed...

**********
var processor = context + '.' +
rootPackage.subPackage.util.getUserAgentProcessor();
jingo.anonymous({
require: [processor],
exec: function() {
return eval(processor);
}
});

**********

Cheers!
GP

Sean

unread,
Oct 29, 2009, 3:03:32 PM10/29/09
to Jingo Users
There is a new parameter to anonymous/declare available in the current
SNAPSHOT release of Jingo called 'dynamic'. This allows you to flag a
module and its dependency subgraph as dynamic only. The parameter
defaults to false, but if you include it in your anonymous block and
set it to true it will let the Jingo Static Assembler know it should
leave it alone.

***********************************

jingo.anonymous({
dynamic: true,
require: [
'resource.bundle_' + locale
],
exec: function() {
// ... create some localized stuff
}
});

***********************************

Hope that helps :-)

-Sean

BreweR

unread,
Oct 30, 2009, 11:23:21 AM10/30/09
to Jingo Users
That is perfect!
Thank you sir!

BreweR

unread,
Nov 10, 2009, 8:46:19 AM11/10/09
to Jingo Users
Hi,

I really appreciate your assistance as I'm digging Jingo ;-)
A follow-up question to the above...
Is there a way to declare static and dynamic modules together? In our
example, is there a mechanism for the following (or something
similar)? This way we get the benefit of static assembly on the static
modules and leave only the dynamic ones for runtime.


***********************************

jingo.anonymous({
require: [
'resource.init'
],
dynamic: [

Sean

unread,
Nov 10, 2009, 10:20:24 AM11/10/09
to Jingo Users
Currently and entire module is either available for static assembly or
it is not. However, you could use a nested anonymous block to achieve
what you are describing.

***********************************

jingo.anonymous({
require: [
'resource.init'
],
exec: function() {
jingo.anonymous({
dynamic: true,
require: [
'resource.bundle_' + locale
],
exec: function() {
// ... create some localized stuff
}
});
}
});

***********************************

keith

unread,
Nov 16, 2009, 12:56:02 PM11/16/09
to Jingo Users
Is there any plans to put this functionality into a single jingo block
so that we can have both static and dynamic dependencies without
having to nest?

Sean

unread,
Nov 16, 2009, 3:58:46 PM11/16/09
to Jingo Users
It's doubtful that it would be prioritized into the upcoming release,
but I'll add it as a proposed enhancement to the project. I'm not
sure that mixing static and dynamic dependencies in the same module
promotes good design, but I'd have to see more specific cases to have
a strong opinion one way or another. Regardless, I'll get it recorded
so we don't lose track of the idea.
Reply all
Reply to author
Forward
0 new messages