[Dojo-interest] Trying to create my own packages outside dojo
James Burke
jburke at dojotoolkit.org
Fri Apr 14 17:56:02 MDT 2006
Try this for __package__js:
dojo.hostenv.conditionalLoadModule({
common: ["packages.test.foo"]
});
dojo.hostenv.moduleLoaded("packages.test.*");
This is assuming this sort of widget applies to all rendering
environments (browser, svg, dashboard). If it only applies to a
specific environment, say browser, then change "common" above to
"browser". See the dojo source file src/widget/__package__.js for an
example of specific packages for specific environments.
James
On 4/14/06, John Townsend <johntownsend at gmail.com> wrote:
> Hi,
>
> I would use some help with the package system in dojo.
>
> I would like to try to create my own packages that live outside of
> the dojo system. I have followed the examples on the FAQ will limited
> success. Here's what I am doing.
>
> dojo.js in located in /js
> my package is located in /packages/test
> my file in the package is located in /packages/test/foo.js
> my __package__.js file is located in /packages/test/__package__.js
>
> my __packages__.js looks like this:
>
> alert("loaded");
> dojo.provide("packages.test");
> dojo.widget.manager.registerWidgetPackage("packages.test");
>
> my test file looks like this (BTW.. test file is /test.jsp)
>
> <html>
> <head>
> <script type="text/javascript" src="js/dojo.js"></script>
> <script>
> // Add our package to the system.
> dojo.hostenv.setModulePrefix("packages.test", "../
> packages/test");
> dojo.require("packages.test.*");
> </script>
> </head>
>
> <body>
> <a href="javascript:helloTest()">click me</a>
> </body>
> </html>
>
> /packages/test/foo.js looks like this:
>
> dojo.provide("packages.test.foo");
>
> alert("foo.js");
> function helloTest() {
> alert("hello world");
> }
>
>
> Here's the problem:
>
> If I do a dojo.require("packages.test.*"); --> then my function is
> not defined. If I change the dojo.require to be dojo.require
> ("packages.test.foo"), then my function is found and works fine.
>
> I can see in both in the wildcard case, I can see the __packages__.js
> gets loaded from the alert I put at the top of it. I don't see the
> foo.js getting loaded at all.
>
> In the case of the specific requires, I can see that foo.js gets
> loaded and my function get defined properly..
>
> Any ideas what I am doing wrong? I really would like wildcard
> dojo.require to work. Just FYI.. I am using 0.2.2 kitchen sink which
> I downloaded yesterday.
>
> --> John Townsend
>
>
>
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
More information about the Dojo-interest
mailing list