[Dojo-interest] Layers profiles and dojo 0.4.3

James Burke jburke at dojotoolkit.org
Tue Aug 21 21:45:52 UTC 2007


Yes, you need to have dojo.require("dojo.lang.declare") somewhere in
your code. It is not automatically available in dojo.js (in 0.4.3).

James

On 8/21/07, O'Shea, Sean <Sean.O'Shea at fmr.com> wrote:
> Made some progress, but still having some trouble with the build.
>
> I can create my tcf.js file without any problems. It brings in the .js
> files I've included in the dependencies section of the profile.js file,
> which now looks like this:
>
> var dependencies = [
> ];
>
> dependencies.layers = [
>         {
>                 name: "tcf.js",
>                 resourceName: "fmr.tcf",
>                 layerDependencies: [
>                         "dojo.js"
>                 ],
>                 dependencies: [
>                         "fmr.tcf",
>                         "fmr.tcf.config",
>                         "fmr.tcf.eventing",
>                         "fmr.tcf.logging",
>                         "fmr.tcf.core",
>                         "fmr.tcf.provider",
>                         "fmr.tcf.config.fmrconfig",
>                         "fmr.tcf.eventing.dojoevent",
>                         "fmr.tcf.logging.log4javascriptlogging"
>                 ]
>         }
> ];
>
> dependencies.prefixes = [
>         ["fmr", "fmr"],
>         ["log4javascript", "log4javascript"]
> ];
>
> // NOTE: this MUST be included or a list of files must be output via
> print()
> // manually.
> load("getDependencyList.js");
>
> When I try to include the tcf.js file in my page, I get an error message
> saying that dojo.lang.declare is not a function. I think this error
> message is a result of me using dojo.lang.declare in my custom code. I'm
> using dojo.lang.declare to declare custom classes in fmr.tcf.config.js,
> fmr.tcf.eventing.js etc...
>
> When I open firebug, I see the following:
>
> dojo.lang.declare is not a function
> [Break on this error] getServiceProvider : function(_inp) {
> tcf.js.uncompress... (line 60)
> GET
> http://localhost:8080/fmr-tcf-basic-sample/dojo/src/widget/__package__.j
> s (10ms)dojo.js (line 764)
> GET http://localhost:8080/fmr-tcf-basic-sample/dojo/src/xml/Parse.js
> (20ms)dojo.js (line 764)
> GET http://localhost:8080/fmr-tcf-basic-sample/dojo/src/widget/Widget.js
> (20ms)dojo.js (line 764)
> GET http://localhost:8080/fmr-tcf-basic-sample/dojo/src/lang/declare.js
> (20ms)dojo.js (line 764)
> GET http://localhost:8080/fmr-tcf-basic-sample/dojo/src/ns.js
> (20ms)dojo.js (line 764)
> GET
> http://localhost:8080/fmr-tcf-basic-sample/dojo/src/widget/Manager.js
> (20ms)dojo.js (line 764)
> GET http://localhost:8080/fmr-tcf-basic-sample/dojo/src/a11y.js
> (20ms)dojo.js (line 764)
> GET
> http://localhost:8080/fmr-tcf-basic-sample/dojo/src/uri/__package__.js
> (20ms)
>
> So, it looks like its trying to use dojo.lang.declare before its
> actually downloaded. This is despite the fact that I'm including the
> tcf.js file after the dojo.js file in my main JSP:
>
>         <script type="text/javascript" src="../dojo/dojo.js"></script>
>         <script type="text/javascript"
> src="../tcf.js.uncompressed.js"></script>
>
> Do I have to bring dojo.lang.declare into my tcf.js file? If so, how
> should I go about this
>
> Hope someone can help
>
> Cheers
>
> Sean
>
> -----Original Message-----
> From: dojo-interest-bounces at dojotoolkit.org
> [mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of James Burke
> Sent: Friday, August 10, 2007 5:46 PM
> To: dojo-interest at dojotoolkit.org
> Subject: Re: [Dojo-interest] Layers profiles and dojo 0.4.3
>
> I was just thinking I need to put in a comment about what that means. :)
>
> resourceName in the .profiles file config is a name you can give the
> file for the dojo.provide string for that layer file. So, if you say
> resourceName: "foo.bar", inside that layer file, the following
> statement will be inserted:
>
> dojo.provide("foo.bar");
>
> This allows you to dynamically load the layer via dojo.require(). Note
> that it is a little hazardous to do this in 0.4.3, depending on how
> you have your dependencies set up (if you have the same module in two
> layers, one may overwrite the other, and that may cause bad things).
> In 0.9, there are protections to avoid the overwriting (but doesn't
> help with the duplicate code download).
>
> James
>
> On 8/10/07, O'Shea, Sean <Sean.O'Shea at fmr.com> wrote:
> > Sweet - played around with that a little and it works. My final
> profile
> > file looks like this:
> >
> > dependencies.layers = [
> >         {
> >                 name: "tcf.js",
> >                 resourceName: "fmr.tcf",
> >                 layerDependencies: [
> >                         "dojo.js"
> >                 ],
> >                 dependencies: [
> >                         "fmr.tcf",
> >                   "fmr.tcf.core",
> >                   "fmr.tcf.provider"
> >                 ]
> >         }
> > ];
> >
> > dependencies.prefixes = [
> >         ["fmr", "fmr"]
> > ];
> >
> > I had placed all my custom code under a folder called 'fmr'. My
> > directory structure looks like this:
> >
> > \dojo-0.4.3
> >         \api
> >         \bench
> >         \...
> >         \fmr
> >                 \tcf
> >                 \...
> >         \...
> >         \src
> >                 \animation
> >                 \cal
> >                 \...
> >
> > Looks like I just needed that .prefixes configuration to tell the
> build
> > tool where to look for the tcf files.
> >
> > Just one more question - what does the resourceName configuration
> entry
> > mean in the .profiles files?
> >
> > Thanks again.
> >
> > Sean
> >
> > -----Original Message-----
> > From: dojo-interest-bounces at dojotoolkit.org
> > [mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of James
> Burke
> > Sent: Friday, August 10, 2007 4:11 PM
> > To: dojo-interest at dojotoolkit.org
> > Subject: Re: [Dojo-interest] Layers profiles and dojo 0.4.3
> >
> > It looks like the 0.4.3 profile.js file is missing the prefixes
> > mapping for tcf? Add this part before the call to load()
> >
> > dependencies.prefixes = [
> >         ["tcf", "../fmr"]
> > ];
> >
> > James
> >
> > On 8/10/07, O'Shea, Sean <Sean.O'Shea at fmr.com> wrote:
> > > Hi all,
> > >
> > > I'm using the layers profile to build a personalized version of dojo
> > > 0.4.3 & I'm running into a few issues. My .profile.js file looks
> like
> > > this:
> > >
> > > var dependencies = [
> > >         "dojo.event.*"
> > > ];
> > >
> > > dependencies.layers = [
> > >         {
> > >                 name: "tcf.js",
> > >                 resourceName: "fmr.tcf",
> > >                 layerDependencies: [
> > >                         "dojo.js"
> > >                 ],
> > >                 dependencies: [
> > >                         "fmr.tcf",
> > >                         "fmr.tcf.core",
> > >                         "fmr.tcf.provider"
> > >                 ]
> > >         }
> > > ];
> > >
> > > // NOTE: this MUST be included or a list of files must be output via
> > > print()
> > > // manually.
> > > load("getDependencyList.js");
> > >
> > > Basically, I need a file called tcf.js which is compressed in the
> same
> > > manner as dojo.js and contains all the .js files under the fmr.tcf,
> > > fmr.tcf.core & fmr.tcf.provider directories. When I run my ant build
> > in
> > > debug mode, I get the following output:
> > >
> > > The ' characters around the executable and arguments are
> > > not part of the command.
> > >      [java] Mapping module dependencies...
> > >      [java] Compressing file: ../release/dojo/tcf.js
> > >      [java] Files baked into this build:
> > >
> > >      [java] dojo.js:
> > >      [java] dojoGuardStart.js
> > >      [java] ../src/bootstrap1.js
> > >      [java] ../src/loader.js
> > >      [java] dojoGuardEnd.js
> > >      [java] ../src/hostenv_browser.js
> > >      [java] ../src/lang/common.js
> > >      [java] ../src/lang/array.js
> > >      [java] ../src/lang/extras.js
> > >      [java] ../src/lang/func.js
> > >      [java] ../src/event/common.js
> > >      [java] ../src/event/topic.js
> > >      [java] ../src/event/browser.js
> > >      [java] ../src/event/__package__.js
> > >
> > >      [java] tcf.js:
> > >      [java] ../__package__.js
> > >
> > > Looks like the eventing pieces are being inserted into dojo.js, but
> I
> > > end up with a tcf.js file which is 1KB in size and has none of my
> > custom
> > > code in it.
> > >
> > > Where should I place my code so that the dojo build can pick it up
> and
> > > generate a tcf.js file which contains everything?
> > >
> > > Hope someone can help
> > >
> > > Sean
> > >
> > > PS. I was using the 0.9 build of dojo and was able to get this
> working
> > > with the following profile.js file:
> > >
> > > dependencies = {
> > >         layers: [
> > >                 {
> > >                         name: "../tcf.js",
> > >                         layerDependencies: [
> > >                                 "dojo.js"
> > >                         ],
> > >                         dependencies: [
> > >                                 "fmr.tcf",
> > >                                 "fmr.tcf.core",
> > >                                 "fmr.tcf.provider"
> > >                         ]
> > >                 }
> > >         ],
> > >
> > >         prefixes: [
> > >                 [ "tcf", "../fmr" ]
> > >         ]
> > > }
> > >
> > > I had to back out of the 0.9 build of dojo though (which looks
> really
> > > good btw) because the FilteringTable isn't ready just yet ...
> > > _______________________________________________
> > > FAQ: http://dojotoolkit.org/support/faq
> > > Book: http://dojotoolkit.org/docs/book
> > > Forums: http://dojotoolkit.org/forum
> > > Dojo-interest at dojotoolkit.org
> > > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > >
> > _______________________________________________
> > FAQ: http://dojotoolkit.org/support/faq
> > Book: http://dojotoolkit.org/docs/book
> > Forums: http://dojotoolkit.org/forum
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> > _______________________________________________
> > FAQ: http://dojotoolkit.org/support/faq
> > Book: http://dojotoolkit.org/docs/book
> > Forums: http://dojotoolkit.org/forum
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>


More information about the Dojo-interest mailing list