Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

ajile · Ajile :: JavaScript Namespace & Imports

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 27
  • Category: JavaScript
  • Founded: Jul 15, 2006
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 221 - 271 of 301   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#221 From: "rme451" <rme451@...>
Date: Mon Nov 17, 2008 12:34 pm
Subject: XUL and Ajile
rme451
Send Email Send Email
 
Hello,

Please excuse my ignorance if this is an obvious question, but...

We are putting together an addon for Firefox & I'm investigating
whether we can use Ajile to enable our users to extend it.

I have an overlay XUL file that contains the script tag to include the
Ajile library. I turned MVC off. But any Ajile calls I make generate
errors indicating that the Ajile library's not been found or loaded
correctly.

For example the call Ajile.ShowLog() gives the exception
"ReferenceError: Ajile is not defined".

Putting some alerts in the ajile file indicates that it is loaded.

Thanks in advance for your help.

#222 From: "mikeizworkin" <mikeizworkin@...>
Date: Mon Nov 17, 2008 3:16 pm
Subject: Re: XUL and Ajile
mikeizworkin
Send Email Send Email
 
Hi,
Thanks for posting and providing error information.

Is it possible for you to post a sample of XUL file using Ajile the way you're
trying to?

I can think of one possibility for why you're seeing a problem...Please try the
following and
let me know if it solves the problem.

Load Ajile as follows in your XUL page:

      <script ...
src=".../com.iskitz.ajile.js?cloakoff,mvcoff,mvcshareoff"></script>

Seems you may already understand, but just in case you don't, the mvcoff and
mvcshareoff load-time settings deactivate Ajile's default MVC support for auto
loading the
current pages' control script (my.js for my.xul) and the shared control script
(index.js).
This auto-load behavior is enabled by default.

Using the cloakoff load-time setting might solve the problem because it
deactivates Ajile's
default cloaking behavior that automatically removes dynamically generated
script tags
from the DOM immediately after the loaded scripts are processed. The extensions
environment may be removing processed scripts from memory when Ajile removes
their
tags from the DOM. In the client-side environment, removing scripts from the DOM
doesn't unload them from memory, so cloaking has no negative effects there.

Please try using cloakoff and let me know if it works. A XUL sample using Ajile
would also
be very helpful.


Thanks!
Michael

--- In ajile@yahoogroups.com, "rme451" <rme451@...> wrote:
>
> Hello,
>
> Please excuse my ignorance if this is an obvious question, but...
>
> We are putting together an addon for Firefox & I'm investigating
> whether we can use Ajile to enable our users to extend it.
>
> I have an overlay XUL file that contains the script tag to include the
> Ajile library. I turned MVC off. But any Ajile calls I make generate
> errors indicating that the Ajile library's not been found or loaded
> correctly.
>
> For example the call Ajile.ShowLog() gives the exception
> "ReferenceError: Ajile is not defined".
>
> Putting some alerts in the ajile file indicates that it is loaded.
>
> Thanks in advance for your help.
>

#223 From: "rme451" <rme451@...>
Date: Mon Nov 17, 2008 6:45 pm
Subject: Re: XUL and Ajile
rme451
Send Email Send Email
 
--- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@...> wrote:
>
> Hi,
> Thanks for posting and providing error information.
>
> Is it possible for you to post a sample of XUL file using Ajile the
way you're trying to?
>

Hi Michael,

Thanks very much for the quick and encouraging response.

With a dumb question like that I was expecting short shrift, so
thankyou!

Your library is elegant & seems to offer exactly what we're looking
for, so I'm hopeful that we may be able to use it from firefox addon
land.

I'm developing using Firefox 2.0.0.18.

I tried the cloakoff setting without any luck.

I tried your 'cloakoff,mvcoff,mvcshareoff' and established (with
alerts) the file was being included.

I enabled the alert in the src (com.iskitz.ajile.1.2.1.src.js)
version, and (ominously) got a full house of falses:

alert("LOADER: "+getMainLoader(document)
+"\n\nisSimple: "+isSimple+"\nisDOM: "+isDOM+"\nisDOM05: "+isDOM05+"\n
isDOM1: "+isDOM1+"\nisDOM2: "+isDOM2);

This might be because the document is a XULElement according to
getMainLoader.

I have bundled together an (experimental) version of what we intend
to offer our users:

http://dl.getdropbox.com/u/197051/extdev.zip

It might indicate where I've gone wrong.

The readme will give you an idea about how to set-up.

Let me know if it won't fire-up right, & apologies in advance for its
lack of sophistication.

If you do a search-in-files (*.xul;*.js) for 'AJILE-TEST' it will
take you to my feeble attempts to get up to speed.

Thanks once again for your help.

Regards,

Richard

#224 From: "mikeizworkin" <mikeizworkin@...>
Date: Mon Nov 17, 2008 10:35 pm
Subject: Re: XUL and Ajile
mikeizworkin
Send Email Send Email
 
Richard,
No problem. Thanks for responding with details and posting the problematic code.

I've downloaded it and will try to take a look at this tonight. Hopefully I'll
find a solution
that meets your needs. Not sure when I'll know for sure, but I'll keep you
posted.

Best,
Michael


--- In ajile@yahoogroups.com, "rme451" <rme451@...> wrote:
>
> --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> >
> > Hi,
> > Thanks for posting and providing error information.
> >
> > Is it possible for you to post a sample of XUL file using Ajile the
> way you're trying to?
> >
>
> Hi Michael,
>
> Thanks very much for the quick and encouraging response.
>
> With a dumb question like that I was expecting short shrift, so
> thankyou!
>
> Your library is elegant & seems to offer exactly what we're looking
> for, so I'm hopeful that we may be able to use it from firefox addon
> land.
>
> I'm developing using Firefox 2.0.0.18.
>
> I tried the cloakoff setting without any luck.
>
> I tried your 'cloakoff,mvcoff,mvcshareoff' and established (with
> alerts) the file was being included.
>
> I enabled the alert in the src (com.iskitz.ajile.1.2.1.src.js)
> version, and (ominously) got a full house of falses:
>
> alert("LOADER: "+getMainLoader(document)
> +"\n\nisSimple: "+isSimple+"\nisDOM: "+isDOM+"\nisDOM05: "+isDOM05+"\n
> isDOM1: "+isDOM1+"\nisDOM2: "+isDOM2);
>
> This might be because the document is a XULElement according to
> getMainLoader.
>
> I have bundled together an (experimental) version of what we intend
> to offer our users:
>
> http://dl.getdropbox.com/u/197051/extdev.zip
>
> It might indicate where I've gone wrong.
>
> The readme will give you an idea about how to set-up.
>
> Let me know if it won't fire-up right, & apologies in advance for its
> lack of sophistication.
>
> If you do a search-in-files (*.xul;*.js) for 'AJILE-TEST' it will
> take you to my feeble attempts to get up to speed.
>
> Thanks once again for your help.
>
> Regards,
>
> Richard
>

#225 From: "mikeizworkin" <mikeizworkin@...>
Date: Thu Nov 20, 2008 7:38 pm
Subject: Re: XUL and Ajile
mikeizworkin
Send Email Send Email
 
Richard,
I've spent some time looking at Ajile working with your extension and am
definitely hitting
some challenges, the least of which is understanding XUL's structure: overlays,
expected
behavior of dynamic DOM updates, specifically dynamic scripts.

I'm going to spend some more time looking into this, I'm curious why the XUL
environment
is behaving differently. I've modified Ajile such that the loaded scripts get
written to the
DOM, but those scripts don''t seem to be executing.

Maybe you can help me better understand the XUL environment. I've been looking
through
Mozilla's Developer Center XUL Docs, but haven't found a clean simple
explanation of
DOM differences between client-side pages and extensions...

I'm trying to understand whether XUL can handle dynamic scripts via DOM updates
or if
some other special loader is needed.

Michael

--- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@...> wrote:
>
> Richard,
> No problem. Thanks for responding with details and posting the problematic
code.
>
> I've downloaded it and will try to take a look at this tonight. Hopefully I'll
find a solution
> that meets your needs. Not sure when I'll know for sure, but I'll keep you
posted.
>
> Best,
> Michael
>
>
> --- In ajile@yahoogroups.com, "rme451" <rme451@> wrote:
> >
> > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> > >
> > > Hi,
> > > Thanks for posting and providing error information.
> > >
> > > Is it possible for you to post a sample of XUL file using Ajile the
> > way you're trying to?
> > >
> >
> > Hi Michael,
> >
> > Thanks very much for the quick and encouraging response.
> >
> > With a dumb question like that I was expecting short shrift, so
> > thankyou!
> >
> > Your library is elegant & seems to offer exactly what we're looking
> > for, so I'm hopeful that we may be able to use it from firefox addon
> > land.
> >
> > I'm developing using Firefox 2.0.0.18.
> >
> > I tried the cloakoff setting without any luck.
> >
> > I tried your 'cloakoff,mvcoff,mvcshareoff' and established (with
> > alerts) the file was being included.
> >
> > I enabled the alert in the src (com.iskitz.ajile.1.2.1.src.js)
> > version, and (ominously) got a full house of falses:
> >
> > alert("LOADER: "+getMainLoader(document)
> > +"\n\nisSimple: "+isSimple+"\nisDOM: "+isDOM+"\nisDOM05: "+isDOM05+"\n
> > isDOM1: "+isDOM1+"\nisDOM2: "+isDOM2);
> >
> > This might be because the document is a XULElement according to
> > getMainLoader.
> >
> > I have bundled together an (experimental) version of what we intend
> > to offer our users:
> >
> > http://dl.getdropbox.com/u/197051/extdev.zip
> >
> > It might indicate where I've gone wrong.
> >
> > The readme will give you an idea about how to set-up.
> >
> > Let me know if it won't fire-up right, & apologies in advance for its
> > lack of sophistication.
> >
> > If you do a search-in-files (*.xul;*.js) for 'AJILE-TEST' it will
> > take you to my feeble attempts to get up to speed.
> >
> > Thanks once again for your help.
> >
> > Regards,
> >
> > Richard
> >
>

#226 From: "rme451" <rme451@...>
Date: Fri Nov 21, 2008 8:54 pm
Subject: Re: XUL and Ajile
rme451
Send Email Send Email
 
--- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@...> wrote:
>
> Richard,
> I've spent some time looking at Ajile working with your extension
and am definitely hitting
> some challenges, the least of which is understanding XUL's
structure: overlays, expected
> behavior of dynamic DOM updates, specifically dynamic scripts.
>
> I'm going to spend some more time looking into this, I'm curious why
the XUL environment
> is behaving differently. I've modified Ajile such that the loaded
scripts get written to the
> DOM, but those scripts don''t seem to be executing.
>
> Maybe you can help me better understand the XUL environment. I've
been looking through
> Mozilla's Developer Center XUL Docs, but haven't found a clean
simple explanation of
> DOM differences between client-side pages and extensions...
>
> I'm trying to understand whether XUL can handle dynamic scripts via
DOM updates or if
> some other special loader is needed.
>
> Michael

Hi Michael,

Thanks very much for your reply.

I think it's a lost cause!

I'm sorry I can't be more help.

I don't want to waste your time, but I wonder if some specific
initialization at the start of every page load might be of use with
AJILE in an extension?

Please see http://dl.getdropbox.com/u/197051/overlay2.js for an
example of what I've been trying.

Really appreciate your time, and many thanks again for your help.

Regards,

Richard

#227 From: "iskitzdev" <ajile@...>
Date: Sat Nov 22, 2008 1:13 am
Subject: Re: XUL and Ajile
iskitzdev
Send Email Send Email
 
Richard!

Don't give up just yet! :-)

It's funny, I thought about emailing you around 4 PM today to let you
know I'd found the solution, but decided to work out all of the kinks
first.

Yes, it's true, Ajile can work the way you'd like *and* in the
extensions environment. I'm cleaning up my test code and will post the
working version of your extension as soon as I'm finished.

Cheers!
Michael

--- In ajile@yahoogroups.com, "rme451" <rme451@...> wrote:
>
> Hi Michael,
>
> Thanks very much for your reply.
>
> I think it's a lost cause!
>
> I'm sorry I can't be more help.
>
> I don't want to waste your time, but I wonder if some specific
> initialization at the start of every page load might be of use with
> AJILE in an extension?
>
> Please see http://dl.getdropbox.com/u/197051/overlay2.js for an
> example of what I've been trying.
>
> Really appreciate your time, and many thanks again for your help.
>
> Regards,
>
> Richard
>
>
> --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> >
> > Richard,
> > I've spent some time looking at Ajile working with your extension
> and am definitely hitting
> > some challenges, the least of which is understanding XUL's
> structure: overlays, expected
> > behavior of dynamic DOM updates, specifically dynamic scripts.
> >
> > I'm going to spend some more time looking into this, I'm curious why
> the XUL environment
> > is behaving differently. I've modified Ajile such that the loaded
> scripts get written to the
> > DOM, but those scripts don''t seem to be executing.
> >
> > Maybe you can help me better understand the XUL environment. I've
> been looking through
> > Mozilla's Developer Center XUL Docs, but haven't found a clean
> simple explanation of
> > DOM differences between client-side pages and extensions...
> >
> > I'm trying to understand whether XUL can handle dynamic scripts via
> DOM updates or if
> > some other special loader is needed.
> >
> > Michael

#228 From: "iskitzdev" <ajile@...>
Date: Sun Nov 23, 2008 12:36 am
Subject: Re: XUL and Ajile
iskitzdev
Send Email Send Email
 
Okay Richard.

All set :-) I've uploaded a functional version of your EBI Toolbar
Firefox Extension here:

    http://drop.io/ebitoolbar/

The ebitoolbar.michael.4.zip file contains my changes, the
ebitoolbar.richard.1.zip file contains what you originally sent me.

I've left comments throughout the scripts I've created and modified so
you should be able to find your way through without a problem.

The key files to look at are:

1. firefoxOverlay.xul
2. com.iskitz.ajile.1.2.1-ebi.src.js
3. browser.js

Basically, your XUL overlay loads Ajile which then loads browser.js
because the actual firefox XUL document is browser.xul.

Thanks a lot for contacting me. It's given me the opportunity to
update Ajile to support yet another environment Firefox Extensions
(XUL), so thanks :-)

I'll be doing further investigation to better understand the
differences in the XUL environment so that the official Ajile library
can be used "as is" there as well as in all of its currently supported
environments (aka client-side pages in just about every browser).

Let me know how it goes and if you have questions.


Best,
Michael


--- In ajile@yahoogroups.com, "iskitzdev" <ajile@...> wrote:
>
> Richard!
>
> Don't give up just yet! :-)
>
> It's funny, I thought about emailing you around 4 PM today to let you
> know I'd found the solution, but decided to work out all of the kinks
> first.
>
> Yes, it's true, Ajile can work the way you'd like *and* in the
> extensions environment. I'm cleaning up my test code and will post the
> working version of your extension as soon as I'm finished.
>
> Cheers!
> Michael
>
> --- In ajile@yahoogroups.com, "rme451" <rme451@> wrote:
> >
> > Hi Michael,
> >
> > Thanks very much for your reply.
> >
> > I think it's a lost cause!
> >
> > I'm sorry I can't be more help.
> >
> > I don't want to waste your time, but I wonder if some specific
> > initialization at the start of every page load might be of use with
> > AJILE in an extension?
> >
> > Please see http://dl.getdropbox.com/u/197051/overlay2.js for an
> > example of what I've been trying.
> >
> > Really appreciate your time, and many thanks again for your help.
> >
> > Regards,
> >
> > Richard
> >
> >
> > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> > >
> > > Richard,
> > > I've spent some time looking at Ajile working with your extension
> > and am definitely hitting
> > > some challenges, the least of which is understanding XUL's
> > structure: overlays, expected
> > > behavior of dynamic DOM updates, specifically dynamic scripts.
> > >
> > > I'm going to spend some more time looking into this, I'm curious why
> > the XUL environment
> > > is behaving differently. I've modified Ajile such that the loaded
> > scripts get written to the
> > > DOM, but those scripts don''t seem to be executing.
> > >
> > > Maybe you can help me better understand the XUL environment. I've
> > been looking through
> > > Mozilla's Developer Center XUL Docs, but haven't found a clean
> > simple explanation of
> > > DOM differences between client-side pages and extensions...
> > >
> > > I'm trying to understand whether XUL can handle dynamic scripts via
> > DOM updates or if
> > > some other special loader is needed.
> > >
> > > Michael
>

#229 From: Michael <ajile@...>
Date: Mon Nov 24, 2008 5:00 am
Subject: Re: XUL and Ajile
iskitzdev
Send Email Send Email
 
Hi Richard,
Ajile works well for dynamically loading EBI Toolbar plugins.

I've extracted example 0 of your Google Scholar Examples into a
separate JavaScript file and updated the EBI Toolbar extension to
demonstrate how this and other plugins can easily be dynamically
loaded using Ajile. The updated files are posted at:

	 http://drop.io/ebitoolbar/

Do the following to see a working example:

1.  Download the ebitoolbar.michael.5.zip file.

2.  Extract and use it's contents as your EBI Toolbar Extension
within Firefox.

3.  Launch Firefox.

4.  Hit Enter through all alert boxes.

5.  Press F2, it should alert confirming F2 was pressed, then after
you hit Enter, prompt you for input.

6.  Either hit Enter or change the prompt's default info. I recommend
enter the first time around.

7.  Use the EBI Toolbar to load Google Scholar then perform a search
and observe the listed results.

Basically The example shows that the EBI Toolbar using Ajile can
dynamically load internal or external script files on-demand. The
external script file used by default in my example (Google Scholars
Example 0) resides here: http://tinyurl.com/5sjdrv/

You can try creating plugins elsewhere including on your local drive
then access them via their absolute URLs, i.e. file:///local/path/to/
a/Plugin.js

I've used Ajile to successfully load the following:

- plugins that exist within the extension.
- plugins that exist outside of the extension, but on a local drive
- plugins that exist outside of the extension, on the web (i.e.
http://tinyurl.com/5sjdrv/ )

The fwim.js file within ebitoolbar.michael.5.zip contains code at
lines 108 through 129 that demonstrates how to load and execute plugins.

Very little of Ajile's functionality has been used to show how what
you've asked for is possible. If you wish or need, you can delve
deeper and make use of it's Namespacing and Importing functionality
to define dependencies between your scripts.

I've enjoyed working with your EBI Toolbar extension and learned a
good deal in the process.

Best of luck and feel free to contact me with any questions.


Cheers!
Michael

P.S. The tinyurl link might eventually lead you to a 500 resource
timed out at drop.io, if that happens, just copy the file's Download
link location and use that, but it's pretty long so you might want to
use tinyurl.com to shorten it and try again.


On Nov 22, 2008, at 9:19 PM, Richard Easty wrote:

> Hi Michael,
>
> Thanks very much for your efforts.
>
> We really appreciate your help.
>
> Our plan is to try to support 'plugins' for our toolbar.
>
> Most of the code will be deployed as an extension and will be
> loaded in
> the 'normal' way.
>
> Users will develop their own functions which we'll host at ebi.
>
> We're thinking that these functions could be loaded if and when the
> user
> wants them via Ajile. Perhaps we'll offer a list of all available
> functions and the user will select from it.
>
> So in other words, the js classes that live at ebi will be versions
> of the
> plugin examples I supplied.
>
> Do you think Ajile will support this?
>
> Thanks again,
>
> Richard
>

#230 From: Michael <ajile@...>
Date: Tue Dec 2, 2008 11:45 am
Subject: Re: XUL and Ajile
iskitzdev
Send Email Send Email
 
Richard!
Sorry for the delay, just getting back from the long Thanksgiving
holiday.

Thanks for the kind words. I'm very happy that Ajile is helping you
and your team better achieve your goals :-)

I took a look at your sample and have created a working version
(ebitoolbar.michael.7.zip) at http://drop.io/ebitoolbar/


A few key points:

- Ajile's MVC setting has no effect on the issue shown in your sample.

- Ajile's Listeners are more reliable when used with Include, Import,
and ImportAs statements.


Take a look at the testPluginStatic() function within the scripts/
fwim.js file in the michael.7 sample. The updated sample builds on
the michael.5 sample. I've modified your alert statements to use the
EBILogger so that you can clearly see the loading and listener
handling sequences.

Let me know how things go and as always, feel free to ask any questions.


-Michael


On Nov 26, 2008, at 12:56 PM, Richard Easty wrote:

> Hi Michael!
>
> I can't thank you enough.
>
> That's such a lot of effort.
>
> What an amazingly quick & thorough explanation!
>
> We really appreciate it.
>
> We were thinking we'd be lost in XMLHttpRequest hell trying to get
> something with Ajile's capability up to speed.
>
> With Ajile's help, we're now tempted to put most of our scripts at
> ebi &
> distribute a fairly minimal extension.
>
> Thanks to Ajile, the possibilities are really opening out for us.
>
> We're some distance from re-framing our toolbar so it can take
> advantage
> of Ajile, but we're very grateful.
>
> I'm probably missing some obvious point, but in trying to do some
> simple
> tests without the MVC functions, I'm having some problems. I've
> changed my
> original zipped example so it features the problem I've encountered.
>
> http://dl.getdropbox.com/u/197051/ebitoolbar.richard.2.zip
>
> To summarise, I switched off MVC in the Ajile file and changed the
> function attached to F2, so that it is a simple version of the last
> example you supplied. The new F2 function attempts to do a load of
> a file,
> and sets up a listener. Seems the listener does not get fired on
> the first
> run through. Subsequent attempts do seem to fire though. I dare say
> it's
> something to do with the MVC switch being turned off & some
> initialisation
> not running before the first call.
>
> Cheers! & many thanks once again,
>
> Richard
>
>> Hi Richard,
>> Ajile works well for dynamically loading EBI Toolbar plugins.
>>
>> I've extracted example 0 of your Google Scholar Examples into a
>> separate JavaScript file and updated the EBI Toolbar extension to
>> demonstrate how this and other plugins can easily be dynamically
>> loaded using Ajile. The updated files are posted at:
>>
>>  http://drop.io/ebitoolbar/
>>
>> Do the following to see a working example:
>>
>> 1.  Download the ebitoolbar.michael.5.zip file.
>>
>> 2.  Extract and use it's contents as your EBI Toolbar Extension
>> within Firefox.
>>
>> 3.  Launch Firefox.
>>
>> 4.  Hit Enter through all alert boxes.
>>
>> 5.  Press F2, it should alert confirming F2 was pressed, then after
>> you hit Enter, prompt you for input.
>>
>> 6.  Either hit Enter or change the prompt's default info. I recommend
>> enter the first time around.
>>
>> 7.  Use the EBI Toolbar to load Google Scholar then perform a search
>> and observe the listed results.
>>
>> Basically The example shows that the EBI Toolbar using Ajile can
>> dynamically load internal or external script files on-demand. The
>> external script file used by default in my example (Google Scholars
>> Example 0) resides here: http://tinyurl.com/5sjdrv/
>>
>> You can try creating plugins elsewhere including on your local drive
>> then access them via their absolute URLs, i.e. file:///local/path/to/
>> a/Plugin.js
>>
>> I've used Ajile to successfully load the following:
>>
>> - plugins that exist within the extension.
>> - plugins that exist outside of the extension, but on a local drive
>> - plugins that exist outside of the extension, on the web (i.e.
>> http://tinyurl.com/5sjdrv/ )
>>
>> The fwim.js file within ebitoolbar.michael.5.zip contains code at
>> lines 108 through 129 that demonstrates how to load and execute
>> plugins.
>>
>> Very little of Ajile's functionality has been used to show how what
>> you've asked for is possible. If you wish or need, you can delve
>> deeper and make use of it's Namespacing and Importing functionality
>> to define dependencies between your scripts.
>>
>> I've enjoyed working with your EBI Toolbar extension and learned a
>> good deal in the process.
>>
>> Best of luck and feel free to contact me with any questions.
>>
>>
>> Cheers!
>> Michael
>>
>> P.S. The tinyurl link might eventually lead you to a 500 resource
>> timed out at drop.io, if that happens, just copy the file's Download
>> link location and use that, but it's pretty long so you might want to
>> use tinyurl.com to shorten it and try again.
>>
>>
>> On Nov 22, 2008, at 9:19 PM, Richard Easty wrote:
>>
>>> Hi Michael,
>>>
>>> Thanks very much for your efforts.
>>>
>>> We really appreciate your help.
>>>
>>> Our plan is to try to support 'plugins' for our toolbar.
>>>
>>> Most of the code will be deployed as an extension and will be
>>> loaded in
>>> the 'normal' way.
>>>
>>> Users will develop their own functions which we'll host at ebi.
>>>
>>> We're thinking that these functions could be loaded if and when the
>>> user
>>> wants them via Ajile. Perhaps we'll offer a list of all available
>>> functions and the user will select from it.
>>>
>>> So in other words, the js classes that live at ebi will be versions
>>> of the
>>> plugin examples I supplied.
>>>
>>> Do you think Ajile will support this?
>>>
>>> Thanks again,
>>>
>>> Richard
>>>
>>
>
>

#231 From: Chris Wash <cwash@...>
Date: Thu Dec 11, 2008 5:16 pm
Subject: AJILE + PackTag, recommended strategy?
cwash@...
Send Email Send Email
 
Hello,

Iąm very interested in using AJILE and am wondering if anyone had an idea
for one obstacle I see in the way of being able to cleanly plug this into my
project.  We use packtag (http://www.galan.de/projects/packtag) to compress,
minify, and control the setting of all the client-side caching for us.  What
this means is that most of our JS files get included in a JSP page by using
the PackTag taglib and it produces markup that essentially looks like this:

<script type="text/javascript"
src="/path/to/ErrorHoverBox.js.h-130259695.pack" charset="utf-8"></script>
<script type="text/javascript"
src="/path/to/ErrorHandler.js.h1268316776.pack" charset="utf-8"></script>
<script type="text/javascript" src="/path/to/hideDiv.js.h1060640246.pack"
charset="utf-8"></script>
<script type="text/javascript" src="/path/to/highlight.js.h-1103827952.pack"
charset="utf-8"></script>
<script type="text/javascript" src="/path/to/sortable.js.h451535514.pack"
charset="utf-8"></script>


I havenąt looked in depth at how I would go about plugging these into the
framework, but is this possible?  Can you recommend a strategy for using
AJILE in this setting?  Weąre in dire need of Namespacing and a Dependency
management solution!

Thanks very much,

Chris


[Non-text portions of this message have been removed]

#232 From: "iskitzdev" <ajile@...>
Date: Fri Dec 12, 2008 5:29 am
Subject: Re: AJILE + PackTag, recommended strategy?
iskitzdev
Send Email Send Email
 
Hi Chris,
Thanks for posting and sharing knowledge about PackTag.

I've read the available documentation at the PackTag site and
understand that it's a JSP Tag Library that offers runtime
minification, compression and caching of JavaScript and CSS resources.

At first glance I suspect the major challenging for getting Ajile &
PackTag to work well together is the fact that Ajile uses external
scripts' filenames to support importing namespaced functionality while
PackTag appears to generate renamed script files that may no longer
maintain the filename to namespaced content mapping.

I haven't actually tried using Ajile with PackTag, but believe that
the two technologies could possibly work together under certain
conditions.

I need some time to look into PackTag's actual operation to better
understand what limitations it imposes on Ajile's operation. Let me do
some investigation and get back to you.

-Mike



--- In ajile@yahoogroups.com, Chris Wash <cwash@...> wrote:
>
> Hello,
>
> Iąm very interested in using AJILE and am wondering if anyone had an
idea
> for one obstacle I see in the way of being able to cleanly plug this
into my
> project.  We use packtag (http://www.galan.de/projects/packtag) to
compress,
> minify, and control the setting of all the client-side caching for
us.  What
> this means is that most of our JS files get included in a JSP page
by using
> the PackTag taglib and it produces markup that essentially looks
like this:
>
> <script type="text/javascript"
> src="/path/to/ErrorHoverBox.js.h-130259695.pack"
charset="utf-8"></script>
> <script type="text/javascript"
> src="/path/to/ErrorHandler.js.h1268316776.pack"
charset="utf-8"></script>
> <script type="text/javascript"
src="/path/to/hideDiv.js.h1060640246.pack"
> charset="utf-8"></script>
> <script type="text/javascript"
src="/path/to/highlight.js.h-1103827952.pack"
> charset="utf-8"></script>
> <script type="text/javascript"
src="/path/to/sortable.js.h451535514.pack"
> charset="utf-8"></script>
>
>
> I havenąt looked in depth at how I would go about plugging these
into the
> framework, but is this possible?  Can you recommend a strategy for using
> AJILE in this setting?  Weąre in dire need of Namespacing and a
Dependency
> management solution!
>
> Thanks very much,
>
> Chris
>
>
> [Non-text portions of this message have been removed]
>

#233 From: "iskitzdev" <ajile@...>
Date: Sat Dec 13, 2008 7:58 am
Subject: Re: AJILE + PackTag, recommended strategy?
iskitzdev
Send Email Send Email
 
Hi Chris,
Having spent some time looking at PackTag, I have to say that it would
be challenging to use it with Ajile without modifying either
solution's source code.

The main reasons for this are:

+ Ajile is a client-side solution while PackTag is server-side:

   - Ajile provides dependency support via just-in-time loading
     of required scripts at the client. PackTag packs scripts
     on the server before they reach the client.


+ Ajile relies on scripts' filenames, but PackTag changes them:

   - Ajile provides dependency support by associating JavaScript
     modules with their filenames (i.e. MyStuff is in MyStuff.js).

   - PackTag generates virtual and physical packed files with
     new (non-configurable) names
     (i.e. MyStuff.js -> MyStuff.js.h-1867926113.pack).

   - PackTag's file renaming breaks Ajile's ability to
     dynamically locate and load scripts via statements like
     Import("MyStuff") because MyStuff will no longer be
     mapped to MyStuff.js when packed with PackTag.


Possible Solutions:

1. Use Ajile to create namespaced modules that import
    each other, then combine all of them into one using
    PackTag's <pack:script><src>..</src><src>...</src>

    Ajile will only try to load a module's script file
    if it doesn't find the module in memory. By combining
    and loading all scripts with PackTag, Ajile should be
    able to find those modules within the combined script
    and therfore not need to issue a request for the
    module's script file. This approach may work, but
    sacrifices some of Ajile's automation because you'll
    need to declare all imported scripts in your JSP
    even though you'll have already defined the dependency
    within your JS files. Ordered declaration via PackTag
    should help to avoid additional script file loading.


2. Use something like RPO (http://tinyurl.com/4xyqzk/)
    on your server.

3. Contact PackTag's developer and request configurable
    packed filenames (i.e. No appended ".h-###.pack").

    Ajile provides a refresh option that causes a
    fresh request to be generated for scripts. If PackTag
    could be made to process such requests and serve the
    cached version if the resource is unchanged Ajile can
    be used with it.

4. Set up server-side filtering to translate Ajile's
    normal script requests to PackTag's renamed resources.

    It may be less intrusive if PackTag generated unique
    query strings or directories for packed scripts
    instead of renaming the script files directly.

    If directories were used and the unique id could be
    referenced via a JSP variable, you could use Ajile's
    Namespace statement to dynamically set all imports
    for a specific namespace to point to the proper
    location, thereby getting the most out of both Ajile
    and PackTag i.e.:

    <script>Namespace("net.ajile", "${packedID}/");</script>

I hope you can find a way to use Ajile within your project. If you're
committed to using PackTag, I'd realy suggest speaking with its author
or modifying its source code to gain more flexible script file renaming.


Best,
Mike

--- In ajile@yahoogroups.com, "iskitzdev" <ajile@...> wrote:
>
> Hi Chris,
> Thanks for posting and sharing knowledge about PackTag.
>
> I've read the available documentation at the PackTag site and
> understand that it's a JSP Tag Library that offers runtime
> minification, compression and caching of JavaScript and CSS resources.
>
> At first glance I suspect the major challenging for getting Ajile &
> PackTag to work well together is the fact that Ajile uses external
> scripts' filenames to support importing namespaced functionality while
> PackTag appears to generate renamed script files that may no longer
> maintain the filename to namespaced content mapping.
>
> I haven't actually tried using Ajile with PackTag, but believe that
> the two technologies could possibly work together under certain
> conditions.
>
> I need some time to look into PackTag's actual operation to better
> understand what limitations it imposes on Ajile's operation. Let me do
> some investigation and get back to you.
>
> -Mike
>
>
>
> --- In ajile@yahoogroups.com, Chris Wash <cwash@> wrote:
> >
> > Hello,
> >
> > Iąm very interested in using AJILE and am wondering if anyone had an
> idea
> > for one obstacle I see in the way of being able to cleanly plug this
> into my
> > project.  We use packtag (http://www.galan.de/projects/packtag) to
> compress,
> > minify, and control the setting of all the client-side caching for
> us.  What
> > this means is that most of our JS files get included in a JSP page
> by using
> > the PackTag taglib and it produces markup that essentially looks
> like this:
> >
> > <script type="text/javascript"
> > src="/path/to/ErrorHoverBox.js.h-130259695.pack"
> charset="utf-8"></script>
> > <script type="text/javascript"
> > src="/path/to/ErrorHandler.js.h1268316776.pack"
> charset="utf-8"></script>
> > <script type="text/javascript"
> src="/path/to/hideDiv.js.h1060640246.pack"
> > charset="utf-8"></script>
> > <script type="text/javascript"
> src="/path/to/highlight.js.h-1103827952.pack"
> > charset="utf-8"></script>
> > <script type="text/javascript"
> src="/path/to/sortable.js.h451535514.pack"
> > charset="utf-8"></script>
> >
> >
> > I havenąt looked in depth at how I would go about plugging these
> into the
> > framework, but is this possible?  Can you recommend a strategy for
using
> > AJILE in this setting?  Weąre in dire need of Namespacing and a
> Dependency
> > management solution!
> >
> > Thanks very much,
> >
> > Chris
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

#234 From: "make_you_mad" <chris.wash@...>
Date: Mon Dec 15, 2008 10:32 am
Subject: Re: AJILE + PackTag, recommended strategy?
chris.wash@...
Send Email Send Email
 
Thanks for looking into this Mike.  I'm going to take a look at the
first option before moving on.  As of now, we've had to do all of the
legwork of making sure we include the right dependencies and files by
hand, so I understand by going this long without a solution like this
we've already made some sacrifices that AJILE could have helped with.

I will feel out the pack:tag dev team for any support in this arena.
It seems like the two libraries could compliment each other well.
While RPO looks attractive, unfortunately we find ourselves in a
situation where we serve most of our 'heavy lifting' scripts off of
the app server and not the web server (which would be ideal,
especially once they stabilize.)

Thanks again,

Chris

--- In ajile@yahoogroups.com, "iskitzdev" <ajile@...> wrote:
>
> Hi Chris,
> Having spent some time looking at PackTag, I have to say that it would
> be challenging to use it with Ajile without modifying either
> solution's source code.
>
> The main reasons for this are:
>
> + Ajile is a client-side solution while PackTag is server-side:
>
>   - Ajile provides dependency support via just-in-time loading
>     of required scripts at the client. PackTag packs scripts
>     on the server before they reach the client.
>
>
> + Ajile relies on scripts' filenames, but PackTag changes them:
>
>   - Ajile provides dependency support by associating JavaScript
>     modules with their filenames (i.e. MyStuff is in MyStuff.js).
>
>   - PackTag generates virtual and physical packed files with
>     new (non-configurable) names
>     (i.e. MyStuff.js -> MyStuff.js.h-1867926113.pack).
>
>   - PackTag's file renaming breaks Ajile's ability to
>     dynamically locate and load scripts via statements like
>     Import("MyStuff") because MyStuff will no longer be
>     mapped to MyStuff.js when packed with PackTag.
>
>
> Possible Solutions:
>
> 1. Use Ajile to create namespaced modules that import
>    each other, then combine all of them into one using
>    PackTag's <pack:script><src>..</src><src>...</src>
>
>    Ajile will only try to load a module's script file
>    if it doesn't find the module in memory. By combining
>    and loading all scripts with PackTag, Ajile should be
>    able to find those modules within the combined script
>    and therfore not need to issue a request for the
>    module's script file. This approach may work, but
>    sacrifices some of Ajile's automation because you'll
>    need to declare all imported scripts in your JSP
>    even though you'll have already defined the dependency
>    within your JS files. Ordered declaration via PackTag
>    should help to avoid additional script file loading.
>
>
> 2. Use something like RPO (http://tinyurl.com/4xyqzk/)
>    on your server.
>
> 3. Contact PackTag's developer and request configurable
>    packed filenames (i.e. No appended ".h-###.pack").
>
>    Ajile provides a refresh option that causes a
>    fresh request to be generated for scripts. If PackTag
>    could be made to process such requests and serve the
>    cached version if the resource is unchanged Ajile can
>    be used with it.
>
> 4. Set up server-side filtering to translate Ajile's
>    normal script requests to PackTag's renamed resources.
>
>    It may be less intrusive if PackTag generated unique
>    query strings or directories for packed scripts
>    instead of renaming the script files directly.
>
>    If directories were used and the unique id could be
>    referenced via a JSP variable, you could use Ajile's
>    Namespace statement to dynamically set all imports
>    for a specific namespace to point to the proper
>    location, thereby getting the most out of both Ajile
>    and PackTag i.e.:
>
>    <script>Namespace("net.ajile", "${packedID}/");</script>
>
> I hope you can find a way to use Ajile within your project. If you're
> committed to using PackTag, I'd realy suggest speaking with its author
> or modifying its source code to gain more flexible script file renaming.
>
>
> Best,
> Mike
>
> --- In ajile@yahoogroups.com, "iskitzdev" <ajile@> wrote:
> >
> > Hi Chris,
> > Thanks for posting and sharing knowledge about PackTag.
> >
> > I've read the available documentation at the PackTag site and
> > understand that it's a JSP Tag Library that offers runtime
> > minification, compression and caching of JavaScript and CSS resources.
> >
> > At first glance I suspect the major challenging for getting Ajile &
> > PackTag to work well together is the fact that Ajile uses external
> > scripts' filenames to support importing namespaced functionality while
> > PackTag appears to generate renamed script files that may no longer
> > maintain the filename to namespaced content mapping.
> >
> > I haven't actually tried using Ajile with PackTag, but believe that
> > the two technologies could possibly work together under certain
> > conditions.
> >
> > I need some time to look into PackTag's actual operation to better
> > understand what limitations it imposes on Ajile's operation. Let me do
> > some investigation and get back to you.
> >
> > -Mike
> >
> >
> >
> > --- In ajile@yahoogroups.com, Chris Wash <cwash@> wrote:
> > >
> > > Hello,
> > >
> > > Iąm very interested in using AJILE and am wondering if anyone had an
> > idea
> > > for one obstacle I see in the way of being able to cleanly plug this
> > into my
> > > project.  We use packtag (http://www.galan.de/projects/packtag) to
> > compress,
> > > minify, and control the setting of all the client-side caching for
> > us.  What
> > > this means is that most of our JS files get included in a JSP page
> > by using
> > > the PackTag taglib and it produces markup that essentially looks
> > like this:
> > >
> > > <script type="text/javascript"
> > > src="/path/to/ErrorHoverBox.js.h-130259695.pack"
> > charset="utf-8"></script>
> > > <script type="text/javascript"
> > > src="/path/to/ErrorHandler.js.h1268316776.pack"
> > charset="utf-8"></script>
> > > <script type="text/javascript"
> > src="/path/to/hideDiv.js.h1060640246.pack"
> > > charset="utf-8"></script>
> > > <script type="text/javascript"
> > src="/path/to/highlight.js.h-1103827952.pack"
> > > charset="utf-8"></script>
> > > <script type="text/javascript"
> > src="/path/to/sortable.js.h451535514.pack"
> > > charset="utf-8"></script>
> > >
> > >
> > > I havenąt looked in depth at how I would go about plugging these
> > into the
> > > framework, but is this possible?  Can you recommend a strategy for
> using
> > > AJILE in this setting?  Weąre in dire need of Namespacing and a
> > Dependency
> > > management solution!
> > >
> > > Thanks very much,
> > >
> > > Chris
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>

#235 From: "deltareum" <deltareum@...>
Date: Sat Dec 27, 2008 10:42 pm
Subject: How does a Loaded script use global variables?
deltareum@...
Send Email Send Email
 
I have a global variable in my HTML page, like so:

<script type="text/javascript" src="com.iskitz.ajile.js"></script>
<script>
var foobar=false;
</script>

Later, I load an additional script that needs to modify this variable
foobar. How does the external script access it? Plainly referring to
its name, foobar=true; , as embedded scripts would do, does not work.

Thanks.

#236 From: "mikeizworkin" <mikeizworkin@...>
Date: Mon Dec 29, 2008 4:10 pm
Subject: Re: How does a Loaded script use global variables?
mikeizworkin
Send Email Send Email
 
Hi,
Ajile doesn't try to change any variables you define, so the problem
you've described is probably due to something else in your script setup.

A few comments:

1. What do you mean by "foobar=true...does not work"? Are you saying
that an error is thrown when you try to set foobar to true or that
foobar always remains set to false?

2. Remove Ajile from the picture and try manually loading your scripts
in the order you've described. After doing this does the same problem
still exist?

3. If possible provide a complete sample that demonstrates the problem
you're seeing and state in which browser(s) you see the problem.


Thanks,
Mike

--- In ajile@yahoogroups.com, "deltareum" <deltareum@...> wrote:
>
> I have a global variable in my HTML page, like so:
>
> <script type="text/javascript" src="com.iskitz.ajile.js"></script>
> <script>
> var foobar=false;
> </script>
>
> Later, I load an additional script that needs to modify this variable
> foobar. How does the external script access it? Plainly referring to
> its name, foobar=true; , as embedded scripts would do, does not work.
>
> Thanks.
>

#249 From: "destroyer019" <omarotieku@...>
Date: Fri Oct 23, 2009 7:46 pm
Subject: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Hello,
I have intermediate javascript skills and I am new to ajile. I am working on a
project that will reference multiple javascript frameworks, such as Uize and
VegUI, under one namespace to mix and match useful modules. Is it possible to
use ajile to do this? If so could someone give me a quick explanation of the
process or an example?

#250 From: "destroyer019" <omarotieku@...>
Date: Fri Oct 23, 2009 7:51 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Hello,
> I have intermediate javascript skills and I am new to ajile. I am working on a
project that will reference multiple javascript frameworks, such as Uize and
VegUI, under one namespace to mix and match useful modules. Is it possible to
use ajile to do this? If so could someone give me a quick explanation of the
process or an example?
>
Sorry, I meant to include this the first time. Here is what I have so far.

  Namespace ("com.visualization.test");

  var msg = typeof com.visualization.test == "undefined"
          ? "Failed to create"
          : "Successfully created";

  alert(msg + " the [ com.visualization.test ] namespace!");

  document.write('You are almost there!');

  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");

    function testLoad()
    {
       if(  "undefined" != typeof Uize.Widget.Calendar) {
      	 alert("File was successfully loaded.");
       }


       else alert( "Load test was unsuccessful :-(\n\n"
                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
    }

#251 From: "iskitzdev" <yahoo@...>
Date: Sat Oct 24, 2009 1:52 am
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
iskitzdev
Send Email Send Email
 
Hi,
Thanks for writing.

I'm not sure what type of example you're looking for but I'll give an
explanation of how Ajile works so you can decide if it will meet your needs.

When Ajile's Namespace function is used it creates a set of objects linked as
properties of each other. For instance:

Namespace ("my.name.space");

Creates a global object "my" with a property called "name". The name property
points to another object called "space".

The my object and the name and space properties contained within are immediately
availble after calling the Namespace function.

To load external script files you can use the Load, Import, ImportAs, or Include
functions depending on your specific need.

All of these functions will create a script tag within your HTML page when
called, however the objects within the script loaded via that tag won't be
available for use until the code that called the Ajile function completes. If
that's confusing, consider this example:

Load ("some/script.js");  // contains var a=true;
alert (a);   // displays "undefined"

To use the contents of script.js as soon as possible either use:

Ajile.AddImportListener ("a", function(){
     alert (a);   //displays "true";
}));

or if your code is in a script block in the HTML page use separate script blocks
for the loading and use of the external script's objects:

[script]
Load ("some/script.js");   // contains var a=true;
[/script]

[script]
alert (a);   // displays true
[/script]

Hope that gives you a better idea of how Ajile works.

Michael

--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
>
>
> --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> >
> > Hello,
> > I have intermediate javascript skills and I am new to ajile. I am working on
a project that will reference multiple javascript frameworks, such as Uize and
VegUI, under one namespace to mix and match useful modules. Is it possible to
use ajile to do this? If so could someone give me a quick explanation of the
process or an example?
> >
> Sorry, I meant to include this the first time. Here is what I have so far.
>
>  Namespace ("com.visualization.test");
>
>  var msg = typeof com.visualization.test == "undefined"
>          ? "Failed to create"
>          : "Successfully created";
>
>  alert(msg + " the [ com.visualization.test ] namespace!");
>
>  document.write('You are almost there!');
>
>  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
>
>    function testLoad()
>    {
>       if(  "undefined" != typeof Uize.Widget.Calendar) {
>        alert("File was successfully loaded.");
>       }
>
>
>       else alert( "Load test was unsuccessful :-(\n\n"
>                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
>    }
>

#252 From: "destroyer019" <omarotieku@...>
Date: Sun Oct 25, 2009 6:46 am
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Thanks for the reply Michael, I am beginning to work my way around Ajile now. I
am trying to successfully import a module but I am still experiencing a problem.
I am following the import demo put forth in the documentation but after the
alert telling me that the namespace has been created comes up the page seems to
get stuck and does not finishing loading, ever. I know that the imported module
and its functions will not be available to me until it loads, but I can't seem
to reach that state. Firebug is giving me this message…

Failed to load source for sourceFile scriptTag file://index.js script.tags( )

Failed to load source for sourceFile scriptTag
file://js/com.visualization.test.example.ImportModule.js script.tags( )

my source code looks like this…

<!-- index.html -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
	 <head>
	 <title>PVT</title>
	 <script type="text/javascript" src="js/com.iskitz.ajile.js"></script>

	 </head>
	 <body>

	 </body>

</html>

/* index.js */

  Namespace ("com.visualization.test");

    var msg = typeof com.visualization.test == "undefined"
            ? "Failed to create"
            : "Successfully created";

    alert(msg + " the [ com.visualization.test ] namespace!");

  com.visualization.test.Test = function() {
 	 document.write("I do not know why you don't work.");
  }


  Import ("com.visualization.test.example.ImportModule.*");

    function testImportModule()
    {
       // Test if showContents method has been imported.
       var imported = "undefined" != typeof showContents;

       if(imported)// Test if imported showContents is ImportModule.showContents.
          if("undefined" != typeof com.visualization.test.example.ImportModule)
             if(showContents ==
com.visualization.test.example.ImportModule.showContents)
                imported = true;

       if(imported) showContents();

       else alert( "ImportModule test was unsuccessful :-(\n\n Failed to "
                 + "Import [ com.visualization.test.example.ImportModule.* ]");
    }

com.visualization.test.Test();

/* com.visualization.test.example.ImportModule.js */

Namespace ("com.visualization.test.example.ImportModule");

    com.visualization.test.example.ImportModule = function()
    {
       var THIS = this;

       // Constructor :: Creates public members.
       function $ImportModule()
       {
          this.aNumber            = 1;
          this.aString            = "member 5";
          this.aFunction          = function(){ alert("member 1"); };
          this.anArray            = ["member3"];
          this.anObject           = { member:"member 2" };
          this.aRegularExpression = (/member 6/);
          this.showContents       = showContents;
       }

       function showContents()
       {
          var contents = ".:{ com.visualization.test.example.ImportModule
}:.\n\n";

          alert(contents + (THIS.constructor.toString ? THIS.constructor : ''));
       }

       $ImportModule();
    };

Does anyone see why the script tags are failing to load correctly? I have edited
the path to the js files but ajile seems to locate them just fine. I am at a
loss?


--- In ajile@yahoogroups.com, "iskitzdev" <yahoo@...> wrote:
>
> Hi,
> Thanks for writing.
>
> I'm not sure what type of example you're looking for but I'll give an
explanation of how Ajile works so you can decide if it will meet your needs.
>
> When Ajile's Namespace function is used it creates a set of objects linked as
properties of each other. For instance:
>
> Namespace ("my.name.space");
>
> Creates a global object "my" with a property called "name". The name property
points to another object called "space".
>
> The my object and the name and space properties contained within are
immediately availble after calling the Namespace function.
>
> To load external script files you can use the Load, Import, ImportAs, or
Include functions depending on your specific need.
>
> All of these functions will create a script tag within your HTML page when
called, however the objects within the script loaded via that tag won't be
available for use until the code that called the Ajile function completes. If
that's confusing, consider this example:
>
> Load ("some/script.js");  // contains var a=true;
> alert (a);   // displays "undefined"
>
> To use the contents of script.js as soon as possible either use:
>
> Ajile.AddImportListener ("a", function(){
>     alert (a);   //displays "true";
> }));
>
> or if your code is in a script block in the HTML page use separate script
blocks for the loading and use of the external script's objects:
>
> [script]
> Load ("some/script.js");   // contains var a=true;
> [/script]
>
> [script]
> alert (a);   // displays true
> [/script]
>
> Hope that gives you a better idea of how Ajile works.
>
> Michael
>
> --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> >
> >
> >
> > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > >
> > > Hello,
> > > I have intermediate javascript skills and I am new to ajile. I am working
on a project that will reference multiple javascript frameworks, such as Uize
and VegUI, under one namespace to mix and match useful modules. Is it possible
to use ajile to do this? If so could someone give me a quick explanation of the
process or an example?
> > >
> > Sorry, I meant to include this the first time. Here is what I have so far.
> >
> >  Namespace ("com.visualization.test");
> >
> >  var msg = typeof com.visualization.test == "undefined"
> >          ? "Failed to create"
> >          : "Successfully created";
> >
> >  alert(msg + " the [ com.visualization.test ] namespace!");
> >
> >  document.write('You are almost there!');
> >
> >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> >
> >    function testLoad()
> >    {
> >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> >        alert("File was successfully loaded.");
> >       }
> >
> >
> >       else alert( "Load test was unsuccessful :-(\n\n"
> >                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
> >    }
> >
>

#253 From: "mikeizworkin" <mikeizworkin@...>
Date: Mon Oct 26, 2009 7:26 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
mikeizworkin
Send Email Send Email
 
Hi,
Do you have a name I can use when answering, it feels a bit strange just saying
hi every time :-)

I understand the problem you're having and will go into how to get past that but
as a first step please set Ajile's script tag's src attribute to the following
in your web page:

    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"

That will do the following things:

    1. Disable Ajile's functionality that removes loaded
       scripts from the page after they're no longer needed.

    2. Turn on Ajile's debug mode. You can then use Ajile.ShowLog()
       within your code to see what's occurring as your code executes.

    3. Disable Ajile's automatic loading of the index.js file
       that may exist in the same directory as the Ajile script.

Next, take a look at:

    http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener

When Importing scripts from within other script files you should use
Ajile.AddImportListener to trigger the code that depends on your imported
scripts.

The reason is that in browsers other than Opera, external scripts that load
other scripts must complete their execution before the imported scripts can be
executed. This limitation is the reason why the Ajile.AddImportListener function
exists. The function allows delaying execution of logic that depends on your
imported script until the imported script has been executed.

Requesting an external script then immediately trying to use it as follows will
fail without using the Ajile.AddImportListener function:

    Import ("my.cool.script");

    my.cool.script.DoSomething();

Instead try the following:

    Import ("my.cool.script");

    Ajile.AddImportListener ("my.cool.script", function (module)
    {
       my.cool.script.DoSomething();
    });

The listener approach guarantees that the code that depends on the imported
script will only be executed after that script has been loaded *and* executed.

If you're someone who learns by example, I recommend taking a look at: the
source code for:

    http://ajile.net/examples/Examples.htm
    http://ajile.net/examples/Examples.js

Within those files you'll see a real world example of how Ajile is used to
dynamically load external script files.

Ajile's Overview and Documentation at the following links should also provide
good information:

    http://ajile.net/docs/Ajile-Overview.htm
    http://ajile.net/docs/Ajile-Help.htm

I hope these explanations help you better understand how Ajile works and how it
can be used.


Michael


--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Thanks for the reply Michael, I am beginning to work my way around Ajile now.
I am trying to successfully import a module but I am still experiencing a
problem. I am following the import demo put forth in the documentation but after
the alert telling me that the namespace has been created comes up the page seems
to get stuck and does not finishing loading, ever. I know that the imported
module and its functions will not be available to me until it loads, but I can't
seem to reach that state. Firebug is giving me this message…
>
> Failed to load source for sourceFile scriptTag file://index.js script.tags( )
>
> Failed to load source for sourceFile scriptTag
file://js/com.visualization.test.example.ImportModule.js script.tags( )
>
> my source code looks like this…
>
> <!-- index.html -->
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
> <html>
>  <head>
>  <title>PVT</title>
>  <script type="text/javascript" src="js/com.iskitz.ajile.js"></script>
>
>  </head>
>  <body>
>
>  </body>
>
> </html>
>
> /* index.js */
>
>  Namespace ("com.visualization.test");
>
>    var msg = typeof com.visualization.test == "undefined"
>            ? "Failed to create"
>            : "Successfully created";
>
>    alert(msg + " the [ com.visualization.test ] namespace!");
>
>  com.visualization.test.Test = function() {
>   document.write("I do not know why you don't work.");
>  }
>
>
>  Import ("com.visualization.test.example.ImportModule.*");
>
>    function testImportModule()
>    {
>       // Test if showContents method has been imported.
>       var imported = "undefined" != typeof showContents;
>
>       if(imported)// Test if imported showContents is
ImportModule.showContents.
>          if("undefined" != typeof com.visualization.test.example.ImportModule)
>             if(showContents ==
com.visualization.test.example.ImportModule.showContents)
>                imported = true;
>
>       if(imported) showContents();
>
>       else alert( "ImportModule test was unsuccessful :-(\n\n Failed to "
>                 + "Import [ com.visualization.test.example.ImportModule.* ]");
>    }
>
> com.visualization.test.Test();
>
> /* com.visualization.test.example.ImportModule.js */
>
> Namespace ("com.visualization.test.example.ImportModule");
>
>    com.visualization.test.example.ImportModule = function()
>    {
>       var THIS = this;
>
>       // Constructor :: Creates public members.
>       function $ImportModule()
>       {
>          this.aNumber            = 1;
>          this.aString            = "member 5";
>          this.aFunction          = function(){ alert("member 1"); };
>          this.anArray            = ["member3"];
>          this.anObject           = { member:"member 2" };
>          this.aRegularExpression = (/member 6/);
>          this.showContents       = showContents;
>       }
>
>       function showContents()
>       {
>          var contents = ".:{ com.visualization.test.example.ImportModule
}:.\n\n";
>
>          alert(contents + (THIS.constructor.toString ? THIS.constructor :
''));
>       }
>
>       $ImportModule();
>    };
>
> Does anyone see why the script tags are failing to load correctly? I have
edited the path to the js files but ajile seems to locate them just fine. I am
at a loss?
>
>
> --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> >
> > Hi,
> > Thanks for writing.
> >
> > I'm not sure what type of example you're looking for but I'll give an
explanation of how Ajile works so you can decide if it will meet your needs.
> >
> > When Ajile's Namespace function is used it creates a set of objects linked
as properties of each other. For instance:
> >
> > Namespace ("my.name.space");
> >
> > Creates a global object "my" with a property called "name". The name
property points to another object called "space".
> >
> > The my object and the name and space properties contained within are
immediately availble after calling the Namespace function.
> >
> > To load external script files you can use the Load, Import, ImportAs, or
Include functions depending on your specific need.
> >
> > All of these functions will create a script tag within your HTML page when
called, however the objects within the script loaded via that tag won't be
available for use until the code that called the Ajile function completes. If
that's confusing, consider this example:
> >
> > Load ("some/script.js");  // contains var a=true;
> > alert (a);   // displays "undefined"
> >
> > To use the contents of script.js as soon as possible either use:
> >
> > Ajile.AddImportListener ("a", function(){
> >     alert (a);   //displays "true";
> > }));
> >
> > or if your code is in a script block in the HTML page use separate script
blocks for the loading and use of the external script's objects:
> >
> > [script]
> > Load ("some/script.js");   // contains var a=true;
> > [/script]
> >
> > [script]
> > alert (a);   // displays true
> > [/script]
> >
> > Hope that gives you a better idea of how Ajile works.
> >
> > Michael
> >
> > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > >
> > >
> > >
> > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > >
> > > > Hello,
> > > > I have intermediate javascript skills and I am new to ajile. I am
working on a project that will reference multiple javascript frameworks, such as
Uize and VegUI, under one namespace to mix and match useful modules. Is it
possible to use ajile to do this? If so could someone give me a quick
explanation of the process or an example?
> > > >
> > > Sorry, I meant to include this the first time. Here is what I have so far.
> > >
> > >  Namespace ("com.visualization.test");
> > >
> > >  var msg = typeof com.visualization.test == "undefined"
> > >          ? "Failed to create"
> > >          : "Successfully created";
> > >
> > >  alert(msg + " the [ com.visualization.test ] namespace!");
> > >
> > >  document.write('You are almost there!');
> > >
> > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > >
> > >    function testLoad()
> > >    {
> > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > >        alert("File was successfully loaded.");
> > >       }
> > >
> > >
> > >       else alert( "Load test was unsuccessful :-(\n\n"
> > >                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
> > >    }
> > >
> >
>

#254 From: "destroyer019" <omarotieku@...>
Date: Mon Nov 2, 2009 6:07 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Thanks Michael
My name is Omar, don't know why I didn't start with that. I will try out your
suggestions, you are really good at clearing things up for me.

--- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@...> wrote:
>
> Hi,
> Do you have a name I can use when answering, it feels a bit strange just
saying hi every time :-)
>
> I understand the problem you're having and will go into how to get past that
but as a first step please set Ajile's script tag's src attribute to the
following in your web page:
>
>    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
>
> That will do the following things:
>
>    1. Disable Ajile's functionality that removes loaded
>       scripts from the page after they're no longer needed.
>
>    2. Turn on Ajile's debug mode. You can then use Ajile.ShowLog()
>       within your code to see what's occurring as your code executes.
>
>    3. Disable Ajile's automatic loading of the index.js file
>       that may exist in the same directory as the Ajile script.
>
> Next, take a look at:
>
>    http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
>
> When Importing scripts from within other script files you should use
Ajile.AddImportListener to trigger the code that depends on your imported
scripts.
>
> The reason is that in browsers other than Opera, external scripts that load
other scripts must complete their execution before the imported scripts can be
executed. This limitation is the reason why the Ajile.AddImportListener function
exists. The function allows delaying execution of logic that depends on your
imported script until the imported script has been executed.
>
> Requesting an external script then immediately trying to use it as follows
will fail without using the Ajile.AddImportListener function:
>
>    Import ("my.cool.script");
>
>    my.cool.script.DoSomething();
>
> Instead try the following:
>
>    Import ("my.cool.script");
>
>    Ajile.AddImportListener ("my.cool.script", function (module)
>    {
>       my.cool.script.DoSomething();
>    });
>
> The listener approach guarantees that the code that depends on the imported
script will only be executed after that script has been loaded *and* executed.
>
> If you're someone who learns by example, I recommend taking a look at: the
source code for:
>
>    http://ajile.net/examples/Examples.htm
>    http://ajile.net/examples/Examples.js
>
> Within those files you'll see a real world example of how Ajile is used to
dynamically load external script files.
>
> Ajile's Overview and Documentation at the following links should also provide
good information:
>
>    http://ajile.net/docs/Ajile-Overview.htm
>    http://ajile.net/docs/Ajile-Help.htm
>
> I hope these explanations help you better understand how Ajile works and how
it can be used.
>
>
> Michael
>
>
> --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> >
> > Thanks for the reply Michael, I am beginning to work my way around Ajile
now. I am trying to successfully import a module but I am still experiencing a
problem. I am following the import demo put forth in the documentation but after
the alert telling me that the namespace has been created comes up the page seems
to get stuck and does not finishing loading, ever. I know that the imported
module and its functions will not be available to me until it loads, but I can't
seem to reach that state. Firebug is giving me this message…
> >
> > Failed to load source for sourceFile scriptTag file://index.js script.tags(
)
> >
> > Failed to load source for sourceFile scriptTag
file://js/com.visualization.test.example.ImportModule.js script.tags( )
> >
> > my source code looks like this…
> >
> > <!-- index.html -->
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
> > <html>
> >  <head>
> >  <title>PVT</title>
> >  <script type="text/javascript" src="js/com.iskitz.ajile.js"></script>
> >
> >  </head>
> >  <body>
> >
> >  </body>
> >
> > </html>
> >
> > /* index.js */
> >
> >  Namespace ("com.visualization.test");
> >
> >    var msg = typeof com.visualization.test == "undefined"
> >            ? "Failed to create"
> >            : "Successfully created";
> >
> >    alert(msg + " the [ com.visualization.test ] namespace!");
> >
> >  com.visualization.test.Test = function() {
> >   document.write("I do not know why you don't work.");
> >  }
> >
> >
> >  Import ("com.visualization.test.example.ImportModule.*");
> >
> >    function testImportModule()
> >    {
> >       // Test if showContents method has been imported.
> >       var imported = "undefined" != typeof showContents;
> >
> >       if(imported)// Test if imported showContents is
ImportModule.showContents.
> >          if("undefined" != typeof
com.visualization.test.example.ImportModule)
> >             if(showContents ==
com.visualization.test.example.ImportModule.showContents)
> >                imported = true;
> >
> >       if(imported) showContents();
> >
> >       else alert( "ImportModule test was unsuccessful :-(\n\n Failed to "
> >                 + "Import [ com.visualization.test.example.ImportModule.*
]");
> >    }
> >
> > com.visualization.test.Test();
> >
> > /* com.visualization.test.example.ImportModule.js */
> >
> > Namespace ("com.visualization.test.example.ImportModule");
> >
> >    com.visualization.test.example.ImportModule = function()
> >    {
> >       var THIS = this;
> >
> >       // Constructor :: Creates public members.
> >       function $ImportModule()
> >       {
> >          this.aNumber            = 1;
> >          this.aString            = "member 5";
> >          this.aFunction          = function(){ alert("member 1"); };
> >          this.anArray            = ["member3"];
> >          this.anObject           = { member:"member 2" };
> >          this.aRegularExpression = (/member 6/);
> >          this.showContents       = showContents;
> >       }
> >
> >       function showContents()
> >       {
> >          var contents = ".:{ com.visualization.test.example.ImportModule
}:.\n\n";
> >
> >          alert(contents + (THIS.constructor.toString ? THIS.constructor :
''));
> >       }
> >
> >       $ImportModule();
> >    };
> >
> > Does anyone see why the script tags are failing to load correctly? I have
edited the path to the js files but ajile seems to locate them just fine. I am
at a loss?
> >
> >
> > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > >
> > > Hi,
> > > Thanks for writing.
> > >
> > > I'm not sure what type of example you're looking for but I'll give an
explanation of how Ajile works so you can decide if it will meet your needs.
> > >
> > > When Ajile's Namespace function is used it creates a set of objects linked
as properties of each other. For instance:
> > >
> > > Namespace ("my.name.space");
> > >
> > > Creates a global object "my" with a property called "name". The name
property points to another object called "space".
> > >
> > > The my object and the name and space properties contained within are
immediately availble after calling the Namespace function.
> > >
> > > To load external script files you can use the Load, Import, ImportAs, or
Include functions depending on your specific need.
> > >
> > > All of these functions will create a script tag within your HTML page when
called, however the objects within the script loaded via that tag won't be
available for use until the code that called the Ajile function completes. If
that's confusing, consider this example:
> > >
> > > Load ("some/script.js");  // contains var a=true;
> > > alert (a);   // displays "undefined"
> > >
> > > To use the contents of script.js as soon as possible either use:
> > >
> > > Ajile.AddImportListener ("a", function(){
> > >     alert (a);   //displays "true";
> > > }));
> > >
> > > or if your code is in a script block in the HTML page use separate script
blocks for the loading and use of the external script's objects:
> > >
> > > [script]
> > > Load ("some/script.js");   // contains var a=true;
> > > [/script]
> > >
> > > [script]
> > > alert (a);   // displays true
> > > [/script]
> > >
> > > Hope that gives you a better idea of how Ajile works.
> > >
> > > Michael
> > >
> > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > >
> > > >
> > > >
> > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > > >
> > > > > Hello,
> > > > > I have intermediate javascript skills and I am new to ajile. I am
working on a project that will reference multiple javascript frameworks, such as
Uize and VegUI, under one namespace to mix and match useful modules. Is it
possible to use ajile to do this? If so could someone give me a quick
explanation of the process or an example?
> > > > >
> > > > Sorry, I meant to include this the first time. Here is what I have so
far.
> > > >
> > > >  Namespace ("com.visualization.test");
> > > >
> > > >  var msg = typeof com.visualization.test == "undefined"
> > > >          ? "Failed to create"
> > > >          : "Successfully created";
> > > >
> > > >  alert(msg + " the [ com.visualization.test ] namespace!");
> > > >
> > > >  document.write('You are almost there!');
> > > >
> > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > >
> > > >    function testLoad()
> > > >    {
> > > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > > >        alert("File was successfully loaded.");
> > > >       }
> > > >
> > > >
> > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > >                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
> > > >    }
> > > >
> > >
> >
>

#255 From: "iskitzdev" <yahoo@...>
Date: Sun Nov 8, 2009 6:25 am
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
iskitzdev
Send Email Send Email
 
Omar,
Great to have a name ;-)

Glad I could help you better understand Ajile.

Best of luck,
Michael

--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Thanks Michael
> My name is Omar, don't know why I didn't start with that. I will try out your
suggestions, you are really good at clearing things up for me.
>
> --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> >
> > Hi,
> > Do you have a name I can use when answering, it feels a bit strange just
saying hi every time :-)
> >
> > I understand the problem you're having and will go into how to get past that
but as a first step please set Ajile's script tag's src attribute to the
following in your web page:
> >
> >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> >
> > That will do the following things:
> >
> >    1. Disable Ajile's functionality that removes loaded
> >       scripts from the page after they're no longer needed.
> >
> >    2. Turn on Ajile's debug mode. You can then use Ajile.ShowLog()
> >       within your code to see what's occurring as your code executes.
> >
> >    3. Disable Ajile's automatic loading of the index.js file
> >       that may exist in the same directory as the Ajile script.
> >
> > Next, take a look at:
> >
> >    http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> >
> > When Importing scripts from within other script files you should use
Ajile.AddImportListener to trigger the code that depends on your imported
scripts.
> >
> > The reason is that in browsers other than Opera, external scripts that load
other scripts must complete their execution before the imported scripts can be
executed. This limitation is the reason why the Ajile.AddImportListener function
exists. The function allows delaying execution of logic that depends on your
imported script until the imported script has been executed.
> >
> > Requesting an external script then immediately trying to use it as follows
will fail without using the Ajile.AddImportListener function:
> >
> >    Import ("my.cool.script");
> >
> >    my.cool.script.DoSomething();
> >
> > Instead try the following:
> >
> >    Import ("my.cool.script");
> >
> >    Ajile.AddImportListener ("my.cool.script", function (module)
> >    {
> >       my.cool.script.DoSomething();
> >    });
> >
> > The listener approach guarantees that the code that depends on the imported
script will only be executed after that script has been loaded *and* executed.
> >
> > If you're someone who learns by example, I recommend taking a look at: the
source code for:
> >
> >    http://ajile.net/examples/Examples.htm
> >    http://ajile.net/examples/Examples.js
> >
> > Within those files you'll see a real world example of how Ajile is used to
dynamically load external script files.
> >
> > Ajile's Overview and Documentation at the following links should also
provide good information:
> >
> >    http://ajile.net/docs/Ajile-Overview.htm
> >    http://ajile.net/docs/Ajile-Help.htm
> >
> > I hope these explanations help you better understand how Ajile works and how
it can be used.
> >
> >
> > Michael
> >
> >
> > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > >
> > > Thanks for the reply Michael, I am beginning to work my way around Ajile
now. I am trying to successfully import a module but I am still experiencing a
problem. I am following the import demo put forth in the documentation but after
the alert telling me that the namespace has been created comes up the page seems
to get stuck and does not finishing loading, ever. I know that the imported
module and its functions will not be available to me until it loads, but I can't
seem to reach that state. Firebug is giving me this message…
> > >
> > > Failed to load source for sourceFile scriptTag file://index.js
script.tags( )
> > >
> > > Failed to load source for sourceFile scriptTag
file://js/com.visualization.test.example.ImportModule.js script.tags( )
> > >
> > > my source code looks like this…
> > >
> > > <!-- index.html -->
> > >
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
> > > <html>
> > >  <head>
> > >  <title>PVT</title>
> > >  <script type="text/javascript" src="js/com.iskitz.ajile.js"></script>
> > >
> > >  </head>
> > >  <body>
> > >
> > >  </body>
> > >
> > > </html>
> > >
> > > /* index.js */
> > >
> > >  Namespace ("com.visualization.test");
> > >
> > >    var msg = typeof com.visualization.test == "undefined"
> > >            ? "Failed to create"
> > >            : "Successfully created";
> > >
> > >    alert(msg + " the [ com.visualization.test ] namespace!");
> > >
> > >  com.visualization.test.Test = function() {
> > >   document.write("I do not know why you don't work.");
> > >  }
> > >
> > >
> > >  Import ("com.visualization.test.example.ImportModule.*");
> > >
> > >    function testImportModule()
> > >    {
> > >       // Test if showContents method has been imported.
> > >       var imported = "undefined" != typeof showContents;
> > >
> > >       if(imported)// Test if imported showContents is
ImportModule.showContents.
> > >          if("undefined" != typeof
com.visualization.test.example.ImportModule)
> > >             if(showContents ==
com.visualization.test.example.ImportModule.showContents)
> > >                imported = true;
> > >
> > >       if(imported) showContents();
> > >
> > >       else alert( "ImportModule test was unsuccessful :-(\n\n Failed to "
> > >                 + "Import [ com.visualization.test.example.ImportModule.*
]");
> > >    }
> > >
> > > com.visualization.test.Test();
> > >
> > > /* com.visualization.test.example.ImportModule.js */
> > >
> > > Namespace ("com.visualization.test.example.ImportModule");
> > >
> > >    com.visualization.test.example.ImportModule = function()
> > >    {
> > >       var THIS = this;
> > >
> > >       // Constructor :: Creates public members.
> > >       function $ImportModule()
> > >       {
> > >          this.aNumber            = 1;
> > >          this.aString            = "member 5";
> > >          this.aFunction          = function(){ alert("member 1"); };
> > >          this.anArray            = ["member3"];
> > >          this.anObject           = { member:"member 2" };
> > >          this.aRegularExpression = (/member 6/);
> > >          this.showContents       = showContents;
> > >       }
> > >
> > >       function showContents()
> > >       {
> > >          var contents = ".:{ com.visualization.test.example.ImportModule
}:.\n\n";
> > >
> > >          alert(contents + (THIS.constructor.toString ? THIS.constructor :
''));
> > >       }
> > >
> > >       $ImportModule();
> > >    };
> > >
> > > Does anyone see why the script tags are failing to load correctly? I have
edited the path to the js files but ajile seems to locate them just fine. I am
at a loss?
> > >
> > >
> > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > >
> > > > Hi,
> > > > Thanks for writing.
> > > >
> > > > I'm not sure what type of example you're looking for but I'll give an
explanation of how Ajile works so you can decide if it will meet your needs.
> > > >
> > > > When Ajile's Namespace function is used it creates a set of objects
linked as properties of each other. For instance:
> > > >
> > > > Namespace ("my.name.space");
> > > >
> > > > Creates a global object "my" with a property called "name". The name
property points to another object called "space".
> > > >
> > > > The my object and the name and space properties contained within are
immediately availble after calling the Namespace function.
> > > >
> > > > To load external script files you can use the Load, Import, ImportAs, or
Include functions depending on your specific need.
> > > >
> > > > All of these functions will create a script tag within your HTML page
when called, however the objects within the script loaded via that tag won't be
available for use until the code that called the Ajile function completes. If
that's confusing, consider this example:
> > > >
> > > > Load ("some/script.js");  // contains var a=true;
> > > > alert (a);   // displays "undefined"
> > > >
> > > > To use the contents of script.js as soon as possible either use:
> > > >
> > > > Ajile.AddImportListener ("a", function(){
> > > >     alert (a);   //displays "true";
> > > > }));
> > > >
> > > > or if your code is in a script block in the HTML page use separate
script blocks for the loading and use of the external script's objects:
> > > >
> > > > [script]
> > > > Load ("some/script.js");   // contains var a=true;
> > > > [/script]
> > > >
> > > > [script]
> > > > alert (a);   // displays true
> > > > [/script]
> > > >
> > > > Hope that gives you a better idea of how Ajile works.
> > > >
> > > > Michael
> > > >
> > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > > >
> > > > >
> > > > >
> > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > > > >
> > > > > > Hello,
> > > > > > I have intermediate javascript skills and I am new to ajile. I am
working on a project that will reference multiple javascript frameworks, such as
Uize and VegUI, under one namespace to mix and match useful modules. Is it
possible to use ajile to do this? If so could someone give me a quick
explanation of the process or an example?
> > > > > >
> > > > > Sorry, I meant to include this the first time. Here is what I have so
far.
> > > > >
> > > > >  Namespace ("com.visualization.test");
> > > > >
> > > > >  var msg = typeof com.visualization.test == "undefined"
> > > > >          ? "Failed to create"
> > > > >          : "Successfully created";
> > > > >
> > > > >  alert(msg + " the [ com.visualization.test ] namespace!");
> > > > >
> > > > >  document.write('You are almost there!');
> > > > >
> > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > >
> > > > >    function testLoad()
> > > > >    {
> > > > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > > > >        alert("File was successfully loaded.");
> > > > >       }
> > > > >
> > > > >
> > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > >                 + "Failed to Load [ Uize.Widget.Calendar.js ]");
> > > > >    }
> > > > >
> > > >
> > >
> >
>

#256 From: "destroyer019" <omarotieku@...>
Date: Thu Nov 19, 2009 4:14 am
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Hello Michael,
I am trying to get Ajile to pull resources from the Uize
<http://www.uize.com>   library so I can then setup a prototype class
that uses some methods from Uize and some custom methods in one
function. I have setup a namespace in the index.js file where i have
imported a few modules from the Uize framework. As a test, I have setup
a calender widget from the Uize example page in my index.html, which
calls on these Uize modules. Ajile is pulling in the Uize modules but
the calender widget is not being generated. Firebug gives me the
following warning…

reference to undefined property BE[BF[BD]](function(AO){var
Ax,B,b,Z;if(typeof Ag!...,An=new AT(),AV=new AT();Ag()})("1.2.1")

Am I wrong in using Ajile in this way? Here is the code I have
setup…

<!-- index.html -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
      <head>
          <title>PVT</title>
          <link rel="stylesheet" href="css/page.css"/>
          <link rel="stylesheet" href="css/page.example.css"/>
          <link rel="stylesheet" href="css/widget.calendar.css"/>

          <script type="text/javascript"
src="js/com.iskitz.ajile.js?cloakoff,debug"></script>

      </head>
      <body>
          <script type="text/javascript">

Uize.module ({
      required:[
          //'UizeDotCom.Page.Example.library',
          'Uize.Widget.Page',
          'Uize.Widget.Calendar',
          'Uize.Templates.Calendar'
      ],
      builder:function () {
          /*** create the example page widget ***/
              var page = window.page = new Uize.Widget.Page
/*({evaluator:function (code) {eval (code)}})*/;

          /*** add the calendar child widget ***/
              var calendar = page.addChild (
                  'calendar',
                  Uize.Widget.Calendar,
                  {
                      built:false,
                      html:Uize.Templates.Calendar
                  }
              );

          /*** wire up the page widget ***/
              page.wireUi ();

          /*** some code for demonstrating the widget's programmatic
interface ***/
              function displayCalendarState () {
                  page.setNodeValue ('calendarValue',calendar.get
('value'));
                  page.setNodeValue ('calendarMonth',calendar.get
('month'));
                  page.setNodeValue ('calendarYear',calendar.get
('year'));
              }
              calendar.wire ('Changed.value',displayCalendarState);
              calendar.wire ('Changed.month',displayCalendarState);
              calendar.wire ('Changed.year',displayCalendarState);
              displayCalendarState ();
      }
});

</script>
      </body>
</html>

<!-- The index.js file -->
Namespace ("com.newschool.piim");

Import('Uize.Widget.Page', 'lib/UIZE_js/Uize.Widget.Page.js');

Import('Uize.Widget.Calendar', 'lib/UIZE_js/Uize.Widget.Calendar.js');

Import('Uize.Templates.Calendar',
'lib/UIZE_js/Uize.Templates.Calendar.js');


--- In ajile@yahoogroups.com, "iskitzdev" <yahoo@...> wrote:
>
> Omar,
> Great to have a name ;-)
>
> Glad I could help you better understand Ajile.
>
> Best of luck,
> Michael
>
> --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> >
> > Thanks Michael
> > My name is Omar, don't know why I didn't start with that. I will try
out your suggestions, you are really good at clearing things up for me.
> >
> > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> > >
> > > Hi,
> > > Do you have a name I can use when answering, it feels a bit
strange just saying hi every time :-)
> > >
> > > I understand the problem you're having and will go into how to get
past that but as a first step please set Ajile's script tag's src
attribute to the following in your web page:
> > >
> > >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> > >
> > > That will do the following things:
> > >
> > >    1. Disable Ajile's functionality that removes loaded
> > >       scripts from the page after they're no longer needed.
> > >
> > >    2. Turn on Ajile's debug mode. You can then use Ajile.ShowLog()
> > >       within your code to see what's occurring as your code
executes.
> > >
> > >    3. Disable Ajile's automatic loading of the index.js file
> > >       that may exist in the same directory as the Ajile script.
> > >
> > > Next, take a look at:
> > >
> > >    http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> > >
> > > When Importing scripts from within other script files you should
use Ajile.AddImportListener to trigger the code that depends on your
imported scripts.
> > >
> > > The reason is that in browsers other than Opera, external scripts
that load other scripts must complete their execution before the
imported scripts can be executed. This limitation is the reason why the
Ajile.AddImportListener function exists. The function allows delaying
execution of logic that depends on your imported script until the
imported script has been executed.
> > >
> > > Requesting an external script then immediately trying to use it as
follows will fail without using the Ajile.AddImportListener function:
> > >
> > >    Import ("my.cool.script");
> > >
> > >    my.cool.script.DoSomething();
> > >
> > > Instead try the following:
> > >
> > >    Import ("my.cool.script");
> > >
> > >    Ajile.AddImportListener ("my.cool.script", function (module)
> > >    {
> > >       my.cool.script.DoSomething();
> > >    });
> > >
> > > The listener approach guarantees that the code that depends on the
imported script will only be executed after that script has been loaded
*and* executed.
> > >
> > > If you're someone who learns by example, I recommend taking a look
at: the source code for:
> > >
> > >    http://ajile.net/examples/Examples.htm
> > >    http://ajile.net/examples/Examples.js
> > >
> > > Within those files you'll see a real world example of how Ajile is
used to dynamically load external script files.
> > >
> > > Ajile's Overview and Documentation at the following links should
also provide good information:
> > >
> > >    http://ajile.net/docs/Ajile-Overview.htm
> > >    http://ajile.net/docs/Ajile-Help.htm
> > >
> > > I hope these explanations help you better understand how Ajile
works and how it can be used.
> > >
> > >
> > > Michael
> > >
> > >
> > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > >
> > > > Thanks for the reply Michael, I am beginning to work my way
around Ajile now. I am trying to successfully import a module but I am
still experiencing a problem. I am following the import demo put forth
in the documentation but after the alert telling me that the namespace
has been created comes up the page seems to get stuck and does not
finishing loading, ever. I know that the imported module and its
functions will not be available to me until it loads, but I can't seem
to reach that state. Firebug is giving me this message…
> > > >
> > > > Failed to load source for sourceFile scriptTag file://index.js
script.tags( )
> > > >
> > > > Failed to load source for sourceFile scriptTag
file://js/com.visualization.test.example.ImportModule.js script.tags( )
> > > >
> > > > my source code looks like this…
> > > >
> > > > <!-- index.html -->
> > > >
> > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
> > > > <html>
> > > >  <head>
> > > >  <title>PVT</title>
> > > >  <script type="text/javascript"
src="js/com.iskitz.ajile.js"></script>
> > > >
> > > >  </head>
> > > >  <body>
> > > >
> > > >  </body>
> > > >
> > > > </html>
> > > >
> > > > /* index.js */
> > > >
> > > >  Namespace ("com.visualization.test");
> > > >
> > > >    var msg = typeof com.visualization.test == "undefined"
> > > >            ? "Failed to create"
> > > >            : "Successfully created";
> > > >
> > > >    alert(msg + " the [ com.visualization.test ] namespace!");
> > > >
> > > >  com.visualization.test.Test = function() {
> > > >   document.write("I do not know why you don't work.");
> > > >  }
> > > >
> > > >
> > > >  Import ("com.visualization.test.example.ImportModule.*");
> > > >
> > > >    function testImportModule()
> > > >    {
> > > >       // Test if showContents method has been imported.
> > > >       var imported = "undefined" != typeof showContents;
> > > >
> > > >       if(imported)// Test if imported showContents is
ImportModule.showContents.
> > > >          if("undefined" != typeof
com.visualization.test.example.ImportModule)
> > > >             if(showContents ==
com.visualization.test.example.ImportModule.showContents)
> > > >                imported = true;
> > > >
> > > >       if(imported) showContents();
> > > >
> > > >       else alert( "ImportModule test was unsuccessful :-(\n\n
Failed to "
> > > >                 + "Import [
com.visualization.test.example.ImportModule.* ]");
> > > >    }
> > > >
> > > > com.visualization.test.Test();
> > > >
> > > > /* com.visualization.test.example.ImportModule.js */
> > > >
> > > > Namespace ("com.visualization.test.example.ImportModule");
> > > >
> > > >    com.visualization.test.example.ImportModule = function()
> > > >    {
> > > >       var THIS = this;
> > > >
> > > >       // Constructor :: Creates public members.
> > > >       function $ImportModule()
> > > >       {
> > > >          this.aNumber            = 1;
> > > >          this.aString            = "member 5";
> > > >          this.aFunction          = function(){ alert("member
1"); };
> > > >          this.anArray            = ["member3"];
> > > >          this.anObject           = { member:"member 2" };
> > > >          this.aRegularExpression = (/member 6/);
> > > >          this.showContents       = showContents;
> > > >       }
> > > >
> > > >       function showContents()
> > > >       {
> > > >          var contents = ".:{
com.visualization.test.example.ImportModule }:.\n\n";
> > > >
> > > >          alert(contents + (THIS.constructor.toString ?
THIS.constructor : ''));
> > > >       }
> > > >
> > > >       $ImportModule();
> > > >    };
> > > >
> > > > Does anyone see why the script tags are failing to load
correctly? I have edited the path to the js files but ajile seems to
locate them just fine. I am at a loss?
> > > >
> > > >
> > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > >
> > > > > Hi,
> > > > > Thanks for writing.
> > > > >
> > > > > I'm not sure what type of example you're looking for but I'll
give an explanation of how Ajile works so you can decide if it will meet
your needs.
> > > > >
> > > > > When Ajile's Namespace function is used it creates a set of
objects linked as properties of each other. For instance:
> > > > >
> > > > > Namespace ("my.name.space");
> > > > >
> > > > > Creates a global object "my" with a property called "name".
The name property points to another object called "space".
> > > > >
> > > > > The my object and the name and space properties contained
within are immediately availble after calling the Namespace function.
> > > > >
> > > > > To load external script files you can use the Load, Import,
ImportAs, or Include functions depending on your specific need.
> > > > >
> > > > > All of these functions will create a script tag within your
HTML page when called, however the objects within the script loaded via
that tag won't be available for use until the code that called the Ajile
function completes. If that's confusing, consider this example:
> > > > >
> > > > > Load ("some/script.js");  // contains var a=true;
> > > > > alert (a);   // displays "undefined"
> > > > >
> > > > > To use the contents of script.js as soon as possible either
use:
> > > > >
> > > > > Ajile.AddImportListener ("a", function(){
> > > > >     alert (a);   //displays "true";
> > > > > }));
> > > > >
> > > > > or if your code is in a script block in the HTML page use
separate script blocks for the loading and use of the external script's
objects:
> > > > >
> > > > > [script]
> > > > > Load ("some/script.js");   // contains var a=true;
> > > > > [/script]
> > > > >
> > > > > [script]
> > > > > alert (a);   // displays true
> > > > > [/script]
> > > > >
> > > > > Hope that gives you a better idea of how Ajile works.
> > > > >
> > > > > Michael
> > > > >
> > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
wrote:
> > > > > > >
> > > > > > > Hello,
> > > > > > > I have intermediate javascript skills and I am new to
ajile. I am working on a project that will reference multiple javascript
frameworks, such as Uize and VegUI, under one namespace to mix and match
useful modules. Is it possible to use ajile to do this? If so could
someone give me a quick explanation of the process or an example?
> > > > > > >
> > > > > > Sorry, I meant to include this the first time. Here is what
I have so far.
> > > > > >
> > > > > >  Namespace ("com.visualization.test");
> > > > > >
> > > > > >  var msg = typeof com.visualization.test == "undefined"
> > > > > >          ? "Failed to create"
> > > > > >          : "Successfully created";
> > > > > >
> > > > > >  alert(msg + " the [ com.visualization.test ] namespace!");
> > > > > >
> > > > > >  document.write('You are almost there!');
> > > > > >
> > > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > > >
> > > > > >    function testLoad()
> > > > > >    {
> > > > > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > > > > >        alert("File was successfully loaded.");
> > > > > >       }
> > > > > >
> > > > > >
> > > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > > >                 + "Failed to Load [ Uize.Widget.Calendar.js
]");
> > > > > >    }
> > > > > >
> > > > >
> > > >
> > >
> >
>



[Non-text portions of this message have been removed]

#257 From: "mikeizworkin" <mikeizworkin@...>
Date: Thu Nov 19, 2009 2:52 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
mikeizworkin
Send Email Send Email
 
Hi Omar,

Looking at the code you're using I'd recommend altering your index.js file as
follows:

    Namespace ("com.newschool.piim");

    // Define the Uize namespace's path:
    Namespace ("Uize", "lib/UIZE_js/");

    // Import Uize modules without needing to specify each path:
    Import ("Uize.Widget.Page");
    Import ("Uize.Widget.Calendar");
    Import ("Uize.Templates.Calendar");

If you prefer to use Import with specific paths you should only specify the
directory not the full file path and filename. Your import statement should look
similar to:

    Import ("Uize.Widget.Page", "lib/UIZE_js/");

Basically you can set the default path for an entire namespace using the
Namespace function with a directory path. For details see:

    http://ajile.net/docs/api/Directives.htm#Namespace

Using Namespace in this way sets the default path for all modules within the
specified namespace to the value you supplied. Later on when you use Import,
Include or ImportAs without specifying a directory path, they will default to
the location specified in the Namespace call.

Hope that helps. Are you using the debug log to observe the paths being used to
load the Uize modules? I find it helpful when modules don't seem to be loading
as expected.


Michael

--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Hello Michael,
> I am trying to get Ajile to pull resources from the Uize
> <http://www.uize.com>   library so I can then setup a prototype class
> that uses some methods from Uize and some custom methods in one
> function. I have setup a namespace in the index.js file where i have
> imported a few modules from the Uize framework. As a test, I have setup
> a calender widget from the Uize example page in my index.html, which
> calls on these Uize modules. Ajile is pulling in the Uize modules but
> the calender widget is not being generated. Firebug gives me the
> following warning…
>
> reference to undefined property BE[BF[BD]](function(AO){var
> Ax,B,b,Z;if(typeof Ag!...,An=new AT(),AV=new AT();Ag()})("1.2.1")
>
> Am I wrong in using Ajile in this way? Here is the code I have
> setup…
>
> <!-- index.html -->
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html>
>      <head>
>          <title>PVT</title>
>          <link rel="stylesheet" href="css/page.css"/>
>          <link rel="stylesheet" href="css/page.example.css"/>
>          <link rel="stylesheet" href="css/widget.calendar.css"/>
>
>          <script type="text/javascript"
> src="js/com.iskitz.ajile.js?cloakoff,debug"></script>
>
>      </head>
>      <body>
>          <script type="text/javascript">
>
> Uize.module ({
>      required:[
>          //'UizeDotCom.Page.Example.library',
>          'Uize.Widget.Page',
>          'Uize.Widget.Calendar',
>          'Uize.Templates.Calendar'
>      ],
>      builder:function () {
>          /*** create the example page widget ***/
>              var page = window.page = new Uize.Widget.Page
> /*({evaluator:function (code) {eval (code)}})*/;
>
>          /*** add the calendar child widget ***/
>              var calendar = page.addChild (
>                  'calendar',
>                  Uize.Widget.Calendar,
>                  {
>                      built:false,
>                      html:Uize.Templates.Calendar
>                  }
>              );
>
>          /*** wire up the page widget ***/
>              page.wireUi ();
>
>          /*** some code for demonstrating the widget's programmatic
> interface ***/
>              function displayCalendarState () {
>                  page.setNodeValue ('calendarValue',calendar.get
> ('value'));
>                  page.setNodeValue ('calendarMonth',calendar.get
> ('month'));
>                  page.setNodeValue ('calendarYear',calendar.get
> ('year'));
>              }
>              calendar.wire ('Changed.value',displayCalendarState);
>              calendar.wire ('Changed.month',displayCalendarState);
>              calendar.wire ('Changed.year',displayCalendarState);
>              displayCalendarState ();
>      }
> });
>
> </script>
>      </body>
> </html>
>
> <!-- The index.js file -->
> Namespace ("com.newschool.piim");
>
> Import('Uize.Widget.Page', 'lib/UIZE_js/Uize.Widget.Page.js');
>
> Import('Uize.Widget.Calendar', 'lib/UIZE_js/Uize.Widget.Calendar.js');
>
> Import('Uize.Templates.Calendar',
> 'lib/UIZE_js/Uize.Templates.Calendar.js');
>
>
> --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> >
> > Omar,
> > Great to have a name ;-)
> >
> > Glad I could help you better understand Ajile.
> >
> > Best of luck,
> > Michael
> >
> > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > >
> > > Thanks Michael
> > > My name is Omar, don't know why I didn't start with that. I will try
> out your suggestions, you are really good at clearing things up for me.
> > >
> > > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@> wrote:
> > > >
> > > > Hi,
> > > > Do you have a name I can use when answering, it feels a bit
> strange just saying hi every time :-)
> > > >
> > > > I understand the problem you're having and will go into how to get
> past that but as a first step please set Ajile's script tag's src
> attribute to the following in your web page:
> > > >
> > > >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> > > >
> > > > That will do the following things:
> > > >
> > > >    1. Disable Ajile's functionality that removes loaded
> > > >       scripts from the page after they're no longer needed.
> > > >
> > > >    2. Turn on Ajile's debug mode. You can then use Ajile.ShowLog()
> > > >       within your code to see what's occurring as your code
> executes.
> > > >
> > > >    3. Disable Ajile's automatic loading of the index.js file
> > > >       that may exist in the same directory as the Ajile script.
> > > >
> > > > Next, take a look at:
> > > >
> > > >    http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> > > >
> > > > When Importing scripts from within other script files you should
> use Ajile.AddImportListener to trigger the code that depends on your
> imported scripts.
> > > >
> > > > The reason is that in browsers other than Opera, external scripts
> that load other scripts must complete their execution before the
> imported scripts can be executed. This limitation is the reason why the
> Ajile.AddImportListener function exists. The function allows delaying
> execution of logic that depends on your imported script until the
> imported script has been executed.
> > > >
> > > > Requesting an external script then immediately trying to use it as
> follows will fail without using the Ajile.AddImportListener function:
> > > >
> > > >    Import ("my.cool.script");
> > > >
> > > >    my.cool.script.DoSomething();
> > > >
> > > > Instead try the following:
> > > >
> > > >    Import ("my.cool.script");
> > > >
> > > >    Ajile.AddImportListener ("my.cool.script", function (module)
> > > >    {
> > > >       my.cool.script.DoSomething();
> > > >    });
> > > >
> > > > The listener approach guarantees that the code that depends on the
> imported script will only be executed after that script has been loaded
> *and* executed.
> > > >
> > > > If you're someone who learns by example, I recommend taking a look
> at: the source code for:
> > > >
> > > >    http://ajile.net/examples/Examples.htm
> > > >    http://ajile.net/examples/Examples.js
> > > >
> > > > Within those files you'll see a real world example of how Ajile is
> used to dynamically load external script files.
> > > >
> > > > Ajile's Overview and Documentation at the following links should
> also provide good information:
> > > >
> > > >    http://ajile.net/docs/Ajile-Overview.htm
> > > >    http://ajile.net/docs/Ajile-Help.htm
> > > >
> > > > I hope these explanations help you better understand how Ajile
> works and how it can be used.
> > > >
> > > >
> > > > Michael
> > > >
> > > >
> > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> > > > >
> > > > > Thanks for the reply Michael, I am beginning to work my way
> around Ajile now. I am trying to successfully import a module but I am
> still experiencing a problem. I am following the import demo put forth
> in the documentation but after the alert telling me that the namespace
> has been created comes up the page seems to get stuck and does not
> finishing loading, ever. I know that the imported module and its
> functions will not be available to me until it loads, but I can't seem
> to reach that state. Firebug is giving me this message…
> > > > >
> > > > > Failed to load source for sourceFile scriptTag file://index.js
> script.tags( )
> > > > >
> > > > > Failed to load source for sourceFile scriptTag
> file://js/com.visualization.test.example.ImportModule.js script.tags( )
> > > > >
> > > > > my source code looks like this…
> > > > >
> > > > > <!-- index.html -->
> > > > >
> > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> > > > > <html>
> > > > >  <head>
> > > > >  <title>PVT</title>
> > > > >  <script type="text/javascript"
> src="js/com.iskitz.ajile.js"></script>
> > > > >
> > > > >  </head>
> > > > >  <body>
> > > > >
> > > > >  </body>
> > > > >
> > > > > </html>
> > > > >
> > > > > /* index.js */
> > > > >
> > > > >  Namespace ("com.visualization.test");
> > > > >
> > > > >    var msg = typeof com.visualization.test == "undefined"
> > > > >            ? "Failed to create"
> > > > >            : "Successfully created";
> > > > >
> > > > >    alert(msg + " the [ com.visualization.test ] namespace!");
> > > > >
> > > > >  com.visualization.test.Test = function() {
> > > > >   document.write("I do not know why you don't work.");
> > > > >  }
> > > > >
> > > > >
> > > > >  Import ("com.visualization.test.example.ImportModule.*");
> > > > >
> > > > >    function testImportModule()
> > > > >    {
> > > > >       // Test if showContents method has been imported.
> > > > >       var imported = "undefined" != typeof showContents;
> > > > >
> > > > >       if(imported)// Test if imported showContents is
> ImportModule.showContents.
> > > > >          if("undefined" != typeof
> com.visualization.test.example.ImportModule)
> > > > >             if(showContents ==
> com.visualization.test.example.ImportModule.showContents)
> > > > >                imported = true;
> > > > >
> > > > >       if(imported) showContents();
> > > > >
> > > > >       else alert( "ImportModule test was unsuccessful :-(\n\n
> Failed to "
> > > > >                 + "Import [
> com.visualization.test.example.ImportModule.* ]");
> > > > >    }
> > > > >
> > > > > com.visualization.test.Test();
> > > > >
> > > > > /* com.visualization.test.example.ImportModule.js */
> > > > >
> > > > > Namespace ("com.visualization.test.example.ImportModule");
> > > > >
> > > > >    com.visualization.test.example.ImportModule = function()
> > > > >    {
> > > > >       var THIS = this;
> > > > >
> > > > >       // Constructor :: Creates public members.
> > > > >       function $ImportModule()
> > > > >       {
> > > > >          this.aNumber            = 1;
> > > > >          this.aString            = "member 5";
> > > > >          this.aFunction          = function(){ alert("member
> 1"); };
> > > > >          this.anArray            = ["member3"];
> > > > >          this.anObject           = { member:"member 2" };
> > > > >          this.aRegularExpression = (/member 6/);
> > > > >          this.showContents       = showContents;
> > > > >       }
> > > > >
> > > > >       function showContents()
> > > > >       {
> > > > >          var contents = ".:{
> com.visualization.test.example.ImportModule }:.\n\n";
> > > > >
> > > > >          alert(contents + (THIS.constructor.toString ?
> THIS.constructor : ''));
> > > > >       }
> > > > >
> > > > >       $ImportModule();
> > > > >    };
> > > > >
> > > > > Does anyone see why the script tags are failing to load
> correctly? I have edited the path to the js files but ajile seems to
> locate them just fine. I am at a loss?
> > > > >
> > > > >
> > > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > > >
> > > > > > Hi,
> > > > > > Thanks for writing.
> > > > > >
> > > > > > I'm not sure what type of example you're looking for but I'll
> give an explanation of how Ajile works so you can decide if it will meet
> your needs.
> > > > > >
> > > > > > When Ajile's Namespace function is used it creates a set of
> objects linked as properties of each other. For instance:
> > > > > >
> > > > > > Namespace ("my.name.space");
> > > > > >
> > > > > > Creates a global object "my" with a property called "name".
> The name property points to another object called "space".
> > > > > >
> > > > > > The my object and the name and space properties contained
> within are immediately availble after calling the Namespace function.
> > > > > >
> > > > > > To load external script files you can use the Load, Import,
> ImportAs, or Include functions depending on your specific need.
> > > > > >
> > > > > > All of these functions will create a script tag within your
> HTML page when called, however the objects within the script loaded via
> that tag won't be available for use until the code that called the Ajile
> function completes. If that's confusing, consider this example:
> > > > > >
> > > > > > Load ("some/script.js");  // contains var a=true;
> > > > > > alert (a);   // displays "undefined"
> > > > > >
> > > > > > To use the contents of script.js as soon as possible either
> use:
> > > > > >
> > > > > > Ajile.AddImportListener ("a", function(){
> > > > > >     alert (a);   //displays "true";
> > > > > > }));
> > > > > >
> > > > > > or if your code is in a script block in the HTML page use
> separate script blocks for the loading and use of the external script's
> objects:
> > > > > >
> > > > > > [script]
> > > > > > Load ("some/script.js");   // contains var a=true;
> > > > > > [/script]
> > > > > >
> > > > > > [script]
> > > > > > alert (a);   // displays true
> > > > > > [/script]
> > > > > >
> > > > > > Hope that gives you a better idea of how Ajile works.
> > > > > >
> > > > > > Michael
> > > > > >
> > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
> wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
> wrote:
> > > > > > > >
> > > > > > > > Hello,
> > > > > > > > I have intermediate javascript skills and I am new to
> ajile. I am working on a project that will reference multiple javascript
> frameworks, such as Uize and VegUI, under one namespace to mix and match
> useful modules. Is it possible to use ajile to do this? If so could
> someone give me a quick explanation of the process or an example?
> > > > > > > >
> > > > > > > Sorry, I meant to include this the first time. Here is what
> I have so far.
> > > > > > >
> > > > > > >  Namespace ("com.visualization.test");
> > > > > > >
> > > > > > >  var msg = typeof com.visualization.test == "undefined"
> > > > > > >          ? "Failed to create"
> > > > > > >          : "Successfully created";
> > > > > > >
> > > > > > >  alert(msg + " the [ com.visualization.test ] namespace!");
> > > > > > >
> > > > > > >  document.write('You are almost there!');
> > > > > > >
> > > > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > > > >
> > > > > > >    function testLoad()
> > > > > > >    {
> > > > > > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > > > > > >        alert("File was successfully loaded.");
> > > > > > >       }
> > > > > > >
> > > > > > >
> > > > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > > > >                 + "Failed to Load [ Uize.Widget.Calendar.js
> ]");
> > > > > > >    }
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
>
> [Non-text portions of this message have been removed]
>

#258 From: "destroyer019" <omarotieku@...>
Date: Thu Nov 19, 2009 11:14 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Okay, so if I was to import from three other frameworks in this way,
would I then create a namespace for each of them to grab specific
functions from them? Then create a name space that brings them all
together? My goal is to create one package that abstracts the use the
other four javascript frameworks under one namespace.

--- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@...> wrote:
>
> Hi Omar,
>
> Looking at the code you're using I'd recommend altering your index.js
file as follows:
>
>    Namespace ("com.newschool.piim");
>
>    // Define the Uize namespace's path:
>    Namespace ("Uize", "lib/UIZE_js/");
>
>    // Import Uize modules without needing to specify each path:
>    Import ("Uize.Widget.Page");
>    Import ("Uize.Widget.Calendar");
>    Import ("Uize.Templates.Calendar");
>
> If you prefer to use Import with specific paths you should only
specify the directory not the full file path and filename. Your import
statement should look similar to:
>
>    Import ("Uize.Widget.Page", "lib/UIZE_js/");
>
> Basically you can set the default path for an entire namespace using
the Namespace function with a directory path. For details see:
>
>    http://ajile.net/docs/api/Directives.htm#Namespace
>
> Using Namespace in this way sets the default path for all modules
within the specified namespace to the value you supplied. Later on when
you use Import, Include or ImportAs without specifying a directory path,
they will default to the location specified in the Namespace call.
>
> Hope that helps. Are you using the debug log to observe the paths
being used to load the Uize modules? I find it helpful when modules
don't seem to be loading as expected.
>
>
> Michael
>
> --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> >
> > Hello Michael,
> > I am trying to get Ajile to pull resources from the Uize
> > <http://www.uize.com>   library so I can then setup a prototype
class
> > that uses some methods from Uize and some custom methods in one
> > function. I have setup a namespace in the index.js file where i have
> > imported a few modules from the Uize framework. As a test, I have
setup
> > a calender widget from the Uize example page in my index.html, which
> > calls on these Uize modules. Ajile is pulling in the Uize modules
but
> > the calender widget is not being generated. Firebug gives me the
> > following warning…
> >
> > reference to undefined property BE[BF[BD]](function(AO){var
> > Ax,B,b,Z;if(typeof Ag!...,An=new AT(),AV=new AT();Ag()})("1.2.1")
> >
> > Am I wrong in using Ajile in this way? Here is the code I have
> > setup…
> >
> > <!-- index.html -->
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > "http://www.w3.org/TR/html4/strict.dtd">
> > <html>
> >      <head>
> >          <title>PVT</title>
> >          <link rel="stylesheet" href="css/page.css"/>
> >          <link rel="stylesheet" href="css/page.example.css"/>
> >          <link rel="stylesheet" href="css/widget.calendar.css"/>
> >
> >          <script type="text/javascript"
> > src="js/com.iskitz.ajile.js?cloakoff,debug"></script>
> >
> >      </head>
> >      <body>
> >          <script type="text/javascript">
> >
> > Uize.module ({
> >      required:[
> >          //'UizeDotCom.Page.Example.library',
> >          'Uize.Widget.Page',
> >          'Uize.Widget.Calendar',
> >          'Uize.Templates.Calendar'
> >      ],
> >      builder:function () {
> >          /*** create the example page widget ***/
> >              var page = window.page = new Uize.Widget.Page
> > /*({evaluator:function (code) {eval (code)}})*/;
> >
> >          /*** add the calendar child widget ***/
> >              var calendar = page.addChild (
> >                  'calendar',
> >                  Uize.Widget.Calendar,
> >                  {
> >                      built:false,
> >                      html:Uize.Templates.Calendar
> >                  }
> >              );
> >
> >          /*** wire up the page widget ***/
> >              page.wireUi ();
> >
> >          /*** some code for demonstrating the widget's programmatic
> > interface ***/
> >              function displayCalendarState () {
> >                  page.setNodeValue ('calendarValue',calendar.get
> > ('value'));
> >                  page.setNodeValue ('calendarMonth',calendar.get
> > ('month'));
> >                  page.setNodeValue ('calendarYear',calendar.get
> > ('year'));
> >              }
> >              calendar.wire ('Changed.value',displayCalendarState);
> >              calendar.wire ('Changed.month',displayCalendarState);
> >              calendar.wire ('Changed.year',displayCalendarState);
> >              displayCalendarState ();
> >      }
> > });
> >
> > </script>
> >      </body>
> > </html>
> >
> > <!-- The index.js file -->
> > Namespace ("com.newschool.piim");
> >
> > Import('Uize.Widget.Page', 'lib/UIZE_js/Uize.Widget.Page.js');
> >
> > Import('Uize.Widget.Calendar',
'lib/UIZE_js/Uize.Widget.Calendar.js');
> >
> > Import('Uize.Templates.Calendar',
> > 'lib/UIZE_js/Uize.Templates.Calendar.js');
> >
> >
> > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > >
> > > Omar,
> > > Great to have a name ;-)
> > >
> > > Glad I could help you better understand Ajile.
> > >
> > > Best of luck,
> > > Michael
> > >
> > > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > > >
> > > > Thanks Michael
> > > > My name is Omar, don't know why I didn't start with that. I will
try
> > out your suggestions, you are really good at clearing things up for
me.
> > > >
> > > > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@>
wrote:
> > > > >
> > > > > Hi,
> > > > > Do you have a name I can use when answering, it feels a bit
> > strange just saying hi every time :-)
> > > > >
> > > > > I understand the problem you're having and will go into how to
get
> > past that but as a first step please set Ajile's script tag's src
> > attribute to the following in your web page:
> > > > >
> > > > >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> > > > >
> > > > > That will do the following things:
> > > > >
> > > > >    1. Disable Ajile's functionality that removes loaded
> > > > >       scripts from the page after they're no longer needed.
> > > > >
> > > > >    2. Turn on Ajile's debug mode. You can then use
Ajile.ShowLog()
> > > > >       within your code to see what's occurring as your code
> > executes.
> > > > >
> > > > >    3. Disable Ajile's automatic loading of the index.js file
> > > > >       that may exist in the same directory as the Ajile
script.
> > > > >
> > > > > Next, take a look at:
> > > > >
> > > > >
http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> > > > >
> > > > > When Importing scripts from within other script files you
should
> > use Ajile.AddImportListener to trigger the code that depends on your
> > imported scripts.
> > > > >
> > > > > The reason is that in browsers other than Opera, external
scripts
> > that load other scripts must complete their execution before the
> > imported scripts can be executed. This limitation is the reason why
the
> > Ajile.AddImportListener function exists. The function allows
delaying
> > execution of logic that depends on your imported script until the
> > imported script has been executed.
> > > > >
> > > > > Requesting an external script then immediately trying to use
it as
> > follows will fail without using the Ajile.AddImportListener
function:
> > > > >
> > > > >    Import ("my.cool.script");
> > > > >
> > > > >    my.cool.script.DoSomething();
> > > > >
> > > > > Instead try the following:
> > > > >
> > > > >    Import ("my.cool.script");
> > > > >
> > > > >    Ajile.AddImportListener ("my.cool.script", function
(module)
> > > > >    {
> > > > >       my.cool.script.DoSomething();
> > > > >    });
> > > > >
> > > > > The listener approach guarantees that the code that depends on
the
> > imported script will only be executed after that script has been
loaded
> > *and* executed.
> > > > >
> > > > > If you're someone who learns by example, I recommend taking a
look
> > at: the source code for:
> > > > >
> > > > >    http://ajile.net/examples/Examples.htm
> > > > >    http://ajile.net/examples/Examples.js
> > > > >
> > > > > Within those files you'll see a real world example of how
Ajile is
> > used to dynamically load external script files.
> > > > >
> > > > > Ajile's Overview and Documentation at the following links
should
> > also provide good information:
> > > > >
> > > > >    http://ajile.net/docs/Ajile-Overview.htm
> > > > >    http://ajile.net/docs/Ajile-Help.htm
> > > > >
> > > > > I hope these explanations help you better understand how Ajile
> > works and how it can be used.
> > > > >
> > > > >
> > > > > Michael
> > > > >
> > > > >
> > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
wrote:
> > > > > >
> > > > > > Thanks for the reply Michael, I am beginning to work my way
> > around Ajile now. I am trying to successfully import a module but I
am
> > still experiencing a problem. I am following the import demo put
forth
> > in the documentation but after the alert telling me that the
namespace
> > has been created comes up the page seems to get stuck and does not
> > finishing loading, ever. I know that the imported module and its
> > functions will not be available to me until it loads, but I can't
seem
> > to reach that state. Firebug is giving me this message…
> > > > > >
> > > > > > Failed to load source for sourceFile scriptTag
file://index.js
> > script.tags( )
> > > > > >
> > > > > > Failed to load source for sourceFile scriptTag
> > file://js/com.visualization.test.example.ImportModule.js
script.tags( )
> > > > > >
> > > > > > my source code looks like this…
> > > > > >
> > > > > > <!-- index.html -->
> > > > > >
> > > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > "http://www.w3.org/TR/html4/strict.dtd">
> > > > > > <html>
> > > > > >  <head>
> > > > > >  <title>PVT</title>
> > > > > >  <script type="text/javascript"
> > src="js/com.iskitz.ajile.js"></script>
> > > > > >
> > > > > >  </head>
> > > > > >  <body>
> > > > > >
> > > > > >  </body>
> > > > > >
> > > > > > </html>
> > > > > >
> > > > > > /* index.js */
> > > > > >
> > > > > >  Namespace ("com.visualization.test");
> > > > > >
> > > > > >    var msg = typeof com.visualization.test == "undefined"
> > > > > >            ? "Failed to create"
> > > > > >            : "Successfully created";
> > > > > >
> > > > > >    alert(msg + " the [ com.visualization.test ]
namespace!");
> > > > > >
> > > > > >  com.visualization.test.Test = function() {
> > > > > >   document.write("I do not know why you don't work.");
> > > > > >  }
> > > > > >
> > > > > >
> > > > > >  Import ("com.visualization.test.example.ImportModule.*");
> > > > > >
> > > > > >    function testImportModule()
> > > > > >    {
> > > > > >       // Test if showContents method has been imported.
> > > > > >       var imported = "undefined" != typeof showContents;
> > > > > >
> > > > > >       if(imported)// Test if imported showContents is
> > ImportModule.showContents.
> > > > > >          if("undefined" != typeof
> > com.visualization.test.example.ImportModule)
> > > > > >             if(showContents ==
> > com.visualization.test.example.ImportModule.showContents)
> > > > > >                imported = true;
> > > > > >
> > > > > >       if(imported) showContents();
> > > > > >
> > > > > >       else alert( "ImportModule test was unsuccessful
:-(\n\n
> > Failed to "
> > > > > >                 + "Import [
> > com.visualization.test.example.ImportModule.* ]");
> > > > > >    }
> > > > > >
> > > > > > com.visualization.test.Test();
> > > > > >
> > > > > > /* com.visualization.test.example.ImportModule.js */
> > > > > >
> > > > > > Namespace ("com.visualization.test.example.ImportModule");
> > > > > >
> > > > > >    com.visualization.test.example.ImportModule = function()
> > > > > >    {
> > > > > >       var THIS = this;
> > > > > >
> > > > > >       // Constructor :: Creates public members.
> > > > > >       function $ImportModule()
> > > > > >       {
> > > > > >          this.aNumber            = 1;
> > > > > >          this.aString            = "member 5";
> > > > > >          this.aFunction          = function(){ alert("member
> > 1"); };
> > > > > >          this.anArray            = ["member3"];
> > > > > >          this.anObject           = { member:"member 2" };
> > > > > >          this.aRegularExpression = (/member 6/);
> > > > > >          this.showContents       = showContents;
> > > > > >       }
> > > > > >
> > > > > >       function showContents()
> > > > > >       {
> > > > > >          var contents = ".:{
> > com.visualization.test.example.ImportModule }:.\n\n";
> > > > > >
> > > > > >          alert(contents + (THIS.constructor.toString ?
> > THIS.constructor : ''));
> > > > > >       }
> > > > > >
> > > > > >       $ImportModule();
> > > > > >    };
> > > > > >
> > > > > > Does anyone see why the script tags are failing to load
> > correctly? I have edited the path to the js files but ajile seems to
> > locate them just fine. I am at a loss?
> > > > > >
> > > > > >
> > > > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > > Thanks for writing.
> > > > > > >
> > > > > > > I'm not sure what type of example you're looking for but
I'll
> > give an explanation of how Ajile works so you can decide if it will
meet
> > your needs.
> > > > > > >
> > > > > > > When Ajile's Namespace function is used it creates a set
of
> > objects linked as properties of each other. For instance:
> > > > > > >
> > > > > > > Namespace ("my.name.space");
> > > > > > >
> > > > > > > Creates a global object "my" with a property called
"name".
> > The name property points to another object called "space".
> > > > > > >
> > > > > > > The my object and the name and space properties contained
> > within are immediately availble after calling the Namespace
function.
> > > > > > >
> > > > > > > To load external script files you can use the Load,
Import,
> > ImportAs, or Include functions depending on your specific need.
> > > > > > >
> > > > > > > All of these functions will create a script tag within
your
> > HTML page when called, however the objects within the script loaded
via
> > that tag won't be available for use until the code that called the
Ajile
> > function completes. If that's confusing, consider this example:
> > > > > > >
> > > > > > > Load ("some/script.js");  // contains var a=true;
> > > > > > > alert (a);   // displays "undefined"
> > > > > > >
> > > > > > > To use the contents of script.js as soon as possible
either
> > use:
> > > > > > >
> > > > > > > Ajile.AddImportListener ("a", function(){
> > > > > > >     alert (a);   //displays "true";
> > > > > > > }));
> > > > > > >
> > > > > > > or if your code is in a script block in the HTML page use
> > separate script blocks for the loading and use of the external
script's
> > objects:
> > > > > > >
> > > > > > > [script]
> > > > > > > Load ("some/script.js");   // contains var a=true;
> > > > > > > [/script]
> > > > > > >
> > > > > > > [script]
> > > > > > > alert (a);   // displays true
> > > > > > > [/script]
> > > > > > >
> > > > > > > Hope that gives you a better idea of how Ajile works.
> > > > > > >
> > > > > > > Michael
> > > > > > >
> > > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
> > wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --- In ajile@yahoogroups.com, "destroyer019"
<omarotieku@>
> > wrote:
> > > > > > > > >
> > > > > > > > > Hello,
> > > > > > > > > I have intermediate javascript skills and I am new to
> > ajile. I am working on a project that will reference multiple
javascript
> > frameworks, such as Uize and VegUI, under one namespace to mix and
match
> > useful modules. Is it possible to use ajile to do this? If so could
> > someone give me a quick explanation of the process or an example?
> > > > > > > > >
> > > > > > > > Sorry, I meant to include this the first time. Here is
what
> > I have so far.
> > > > > > > >
> > > > > > > >  Namespace ("com.visualization.test");
> > > > > > > >
> > > > > > > >  var msg = typeof com.visualization.test == "undefined"
> > > > > > > >          ? "Failed to create"
> > > > > > > >          : "Successfully created";
> > > > > > > >
> > > > > > > >  alert(msg + " the [ com.visualization.test ]
namespace!");
> > > > > > > >
> > > > > > > >  document.write('You are almost there!');
> > > > > > > >
> > > > > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > > > > >
> > > > > > > >    function testLoad()
> > > > > > > >    {
> > > > > > > >       if(  "undefined" != typeof Uize.Widget.Calendar) {
> > > > > > > >        alert("File was successfully loaded.");
> > > > > > > >       }
> > > > > > > >
> > > > > > > >
> > > > > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > > > > >                 + "Failed to Load [
Uize.Widget.Calendar.js
> > ]");
> > > > > > > >    }
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

#259 From: "destroyer019" <omarotieku@...>
Date: Mon Nov 23, 2009 9:32 am
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
destroyer019
Send Email Send Email
 
Hey Michael,
I found my problem. I was mistakenly trying to use the Import directive
for a non namespaced script. Uize uses its own method to create and
associate modules. I instead had to use Load to pull the appropriate
scripts into my definied namespace. I can now create my prototype
classes.

Thanks for your help.

--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Okay, so if I was to import from three other frameworks in this way,
> would I then create a namespace for each of them to grab specific
> functions from them? Then create a name space that brings them all
> together? My goal is to create one package that abstracts the use the
> other four javascript frameworks under one namespace.
>
> --- In ajile@yahoogroups.com, "mikeizworkin" mikeizworkin@ wrote:
> >
> > Hi Omar,
> >
> > Looking at the code you're using I'd recommend altering your
index.js
> file as follows:
> >
> >    Namespace ("com.newschool.piim");
> >
> >    // Define the Uize namespace's path:
> >    Namespace ("Uize", "lib/UIZE_js/");
> >
> >    // Import Uize modules without needing to specify each path:
> >    Import ("Uize.Widget.Page");
> >    Import ("Uize.Widget.Calendar");
> >    Import ("Uize.Templates.Calendar");
> >
> > If you prefer to use Import with specific paths you should only
> specify the directory not the full file path and filename. Your import
> statement should look similar to:
> >
> >    Import ("Uize.Widget.Page", "lib/UIZE_js/");
> >
> > Basically you can set the default path for an entire namespace using
> the Namespace function with a directory path. For details see:
> >
> >    http://ajile.net/docs/api/Directives.htm#Namespace
> >
> > Using Namespace in this way sets the default path for all modules
> within the specified namespace to the value you supplied. Later on
when
> you use Import, Include or ImportAs without specifying a directory
path,
> they will default to the location specified in the Namespace call.
> >
> > Hope that helps. Are you using the debug log to observe the paths
> being used to load the Uize modules? I find it helpful when modules
> don't seem to be loading as expected.
> >
> >
> > Michael
> >
> > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > >
> > > Hello Michael,
> > > I am trying to get Ajile to pull resources from the Uize
> > > <http://www.uize.com>   library so I can then setup a prototype
> class
> > > that uses some methods from Uize and some custom methods in one
> > > function. I have setup a namespace in the index.js file where i
have
> > > imported a few modules from the Uize framework. As a test, I have
> setup
> > > a calender widget from the Uize example page in my index.html,
which
> > > calls on these Uize modules. Ajile is pulling in the Uize modules
> but
> > > the calender widget is not being generated. Firebug gives me the
> > > following warning…
> > >
> > > reference to undefined property BE[BF[BD]](function(AO){var
> > > Ax,B,b,Z;if(typeof Ag!...,An=new AT(),AV=new AT();Ag()})("1.2.1")
> > >
> > > Am I wrong in using Ajile in this way? Here is the code I have
> > > setup…
> > >
> > > <!-- index.html -->
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > > "http://www.w3.org/TR/html4/strict.dtd">
> > > <html>
> > >      <head>
> > >          <title>PVT</title>
> > >          <link rel="stylesheet" href="css/page.css"/>
> > >          <link rel="stylesheet" href="css/page.example.css"/>
> > >          <link rel="stylesheet" href="css/widget.calendar.css"/>
> > >
> > >          <script type="text/javascript"
> > > src="js/com.iskitz.ajile.js?cloakoff,debug"></script>
> > >
> > >      </head>
> > >      <body>
> > >          <script type="text/javascript">
> > >
> > > Uize.module ({
> > >      required:[
> > >          //'UizeDotCom.Page.Example.library',
> > >          'Uize.Widget.Page',
> > >          'Uize.Widget.Calendar',
> > >          'Uize.Templates.Calendar'
> > >      ],
> > >      builder:function () {
> > >          /*** create the example page widget ***/
> > >              var page = window.page = new Uize.Widget.Page
> > > /*({evaluator:function (code) {eval (code)}})*/;
> > >
> > >          /*** add the calendar child widget ***/
> > >              var calendar = page.addChild (
> > >                  'calendar',
> > >                  Uize.Widget.Calendar,
> > >                  {
> > >                      built:false,
> > >                      html:Uize.Templates.Calendar
> > >                  }
> > >              );
> > >
> > >          /*** wire up the page widget ***/
> > >              page.wireUi ();
> > >
> > >          /*** some code for demonstrating the widget's
programmatic
> > > interface ***/
> > >              function displayCalendarState () {
> > >                  page.setNodeValue ('calendarValue',calendar.get
> > > ('value'));
> > >                  page.setNodeValue ('calendarMonth',calendar.get
> > > ('month'));
> > >                  page.setNodeValue ('calendarYear',calendar.get
> > > ('year'));
> > >              }
> > >              calendar.wire ('Changed.value',displayCalendarState);
> > >              calendar.wire ('Changed.month',displayCalendarState);
> > >              calendar.wire ('Changed.year',displayCalendarState);
> > >              displayCalendarState ();
> > >      }
> > > });
> > >
> > > </script>
> > >      </body>
> > > </html>
> > >
> > > <!-- The index.js file -->
> > > Namespace ("com.newschool.piim");
> > >
> > > Import('Uize.Widget.Page', 'lib/UIZE_js/Uize.Widget.Page.js');
> > >
> > > Import('Uize.Widget.Calendar',
> 'lib/UIZE_js/Uize.Widget.Calendar.js');
> > >
> > > Import('Uize.Templates.Calendar',
> > > 'lib/UIZE_js/Uize.Templates.Calendar.js');
> > >
> > >
> > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > >
> > > > Omar,
> > > > Great to have a name ;-)
> > > >
> > > > Glad I could help you better understand Ajile.
> > > >
> > > > Best of luck,
> > > > Michael
> > > >
> > > > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > > > >
> > > > > Thanks Michael
> > > > > My name is Omar, don't know why I didn't start with that. I
will
> try
> > > out your suggestions, you are really good at clearing things up
for
> me.
> > > > >
> > > > > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@>
> wrote:
> > > > > >
> > > > > > Hi,
> > > > > > Do you have a name I can use when answering, it feels a bit
> > > strange just saying hi every time :-)
> > > > > >
> > > > > > I understand the problem you're having and will go into how
to
> get
> > > past that but as a first step please set Ajile's script tag's src
> > > attribute to the following in your web page:
> > > > > >
> > > > > >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> > > > > >
> > > > > > That will do the following things:
> > > > > >
> > > > > >    1. Disable Ajile's functionality that removes loaded
> > > > > >       scripts from the page after they're no longer needed.
> > > > > >
> > > > > >    2. Turn on Ajile's debug mode. You can then use
> Ajile.ShowLog()
> > > > > >       within your code to see what's occurring as your code
> > > executes.
> > > > > >
> > > > > >    3. Disable Ajile's automatic loading of the index.js file
> > > > > >       that may exist in the same directory as the Ajile
> script.
> > > > > >
> > > > > > Next, take a look at:
> > > > > >
> > > > > >
> http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> > > > > >
> > > > > > When Importing scripts from within other script files you
> should
> > > use Ajile.AddImportListener to trigger the code that depends on
your
> > > imported scripts.
> > > > > >
> > > > > > The reason is that in browsers other than Opera, external
> scripts
> > > that load other scripts must complete their execution before the
> > > imported scripts can be executed. This limitation is the reason
why
> the
> > > Ajile.AddImportListener function exists. The function allows
> delaying
> > > execution of logic that depends on your imported script until the
> > > imported script has been executed.
> > > > > >
> > > > > > Requesting an external script then immediately trying to use
> it as
> > > follows will fail without using the Ajile.AddImportListener
> function:
> > > > > >
> > > > > >    Import ("my.cool.script");
> > > > > >
> > > > > >    my.cool.script.DoSomething();
> > > > > >
> > > > > > Instead try the following:
> > > > > >
> > > > > >    Import ("my.cool.script");
> > > > > >
> > > > > >    Ajile.AddImportListener ("my.cool.script", function
> (module)
> > > > > >    {
> > > > > >       my.cool.script.DoSomething();
> > > > > >    });
> > > > > >
> > > > > > The listener approach guarantees that the code that depends
on
> the
> > > imported script will only be executed after that script has been
> loaded
> > > *and* executed.
> > > > > >
> > > > > > If you're someone who learns by example, I recommend taking
a
> look
> > > at: the source code for:
> > > > > >
> > > > > >    http://ajile.net/examples/Examples.htm
> > > > > >    http://ajile.net/examples/Examples.js
> > > > > >
> > > > > > Within those files you'll see a real world example of how
> Ajile is
> > > used to dynamically load external script files.
> > > > > >
> > > > > > Ajile's Overview and Documentation at the following links
> should
> > > also provide good information:
> > > > > >
> > > > > >    http://ajile.net/docs/Ajile-Overview.htm
> > > > > >    http://ajile.net/docs/Ajile-Help.htm
> > > > > >
> > > > > > I hope these explanations help you better understand how
Ajile
> > > works and how it can be used.
> > > > > >
> > > > > >
> > > > > > Michael
> > > > > >
> > > > > >
> > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
> wrote:
> > > > > > >
> > > > > > > Thanks for the reply Michael, I am beginning to work my
way
> > > around Ajile now. I am trying to successfully import a module but
I
> am
> > > still experiencing a problem. I am following the import demo put
> forth
> > > in the documentation but after the alert telling me that the
> namespace
> > > has been created comes up the page seems to get stuck and does not
> > > finishing loading, ever. I know that the imported module and its
> > > functions will not be available to me until it loads, but I can't
> seem
> > > to reach that state. Firebug is giving me this message…
> > > > > > >
> > > > > > > Failed to load source for sourceFile scriptTag
> file://index.js
> > > script.tags( )
> > > > > > >
> > > > > > > Failed to load source for sourceFile scriptTag
> > > file://js/com.visualization.test.example.ImportModule.js
> script.tags( )
> > > > > > >
> > > > > > > my source code looks like this…
> > > > > > >
> > > > > > > <!-- index.html -->
> > > > > > >
> > > > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > > "http://www.w3.org/TR/html4/strict.dtd">
> > > > > > > <html>
> > > > > > >  <head>
> > > > > > >  <title>PVT</title>
> > > > > > >  <script type="text/javascript"
> > > src="js/com.iskitz.ajile.js"></script>
> > > > > > >
> > > > > > >  </head>
> > > > > > >  <body>
> > > > > > >
> > > > > > >  </body>
> > > > > > >
> > > > > > > </html>
> > > > > > >
> > > > > > > /* index.js */
> > > > > > >
> > > > > > >  Namespace ("com.visualization.test");
> > > > > > >
> > > > > > >    var msg = typeof com.visualization.test == "undefined"
> > > > > > >            ? "Failed to create"
> > > > > > >            : "Successfully created";
> > > > > > >
> > > > > > >    alert(msg + " the [ com.visualization.test ]
> namespace!");
> > > > > > >
> > > > > > >  com.visualization.test.Test = function() {
> > > > > > >   document.write("I do not know why you don't work.");
> > > > > > >  }
> > > > > > >
> > > > > > >
> > > > > > >  Import ("com.visualization.test.example.ImportModule.*");
> > > > > > >
> > > > > > >    function testImportModule()
> > > > > > >    {
> > > > > > >       // Test if showContents method has been imported.
> > > > > > >       var imported = "undefined" != typeof showContents;
> > > > > > >
> > > > > > >       if(imported)// Test if imported showContents is
> > > ImportModule.showContents.
> > > > > > >          if("undefined" != typeof
> > > com.visualization.test.example.ImportModule)
> > > > > > >             if(showContents ==
> > > com.visualization.test.example.ImportModule.showContents)
> > > > > > >                imported = true;
> > > > > > >
> > > > > > >       if(imported) showContents();
> > > > > > >
> > > > > > >       else alert( "ImportModule test was unsuccessful
> :-(\n\n
> > > Failed to "
> > > > > > >                 + "Import [
> > > com.visualization.test.example.ImportModule.* ]");
> > > > > > >    }
> > > > > > >
> > > > > > > com.visualization.test.Test();
> > > > > > >
> > > > > > > /* com.visualization.test.example.ImportModule.js */
> > > > > > >
> > > > > > > Namespace ("com.visualization.test.example.ImportModule");
> > > > > > >
> > > > > > >    com.visualization.test.example.ImportModule =
function()
> > > > > > >    {
> > > > > > >       var THIS = this;
> > > > > > >
> > > > > > >       // Constructor :: Creates public members.
> > > > > > >       function $ImportModule()
> > > > > > >       {
> > > > > > >          this.aNumber            = 1;
> > > > > > >          this.aString            = "member 5";
> > > > > > >          this.aFunction          = function(){
alert("member
> > > 1"); };
> > > > > > >          this.anArray            = ["member3"];
> > > > > > >          this.anObject           = { member:"member 2" };
> > > > > > >          this.aRegularExpression = (/member 6/);
> > > > > > >          this.showContents       = showContents;
> > > > > > >       }
> > > > > > >
> > > > > > >       function showContents()
> > > > > > >       {
> > > > > > >          var contents = ".:{
> > > com.visualization.test.example.ImportModule }:.\n\n";
> > > > > > >
> > > > > > >          alert(contents + (THIS.constructor.toString ?
> > > THIS.constructor : ''));
> > > > > > >       }
> > > > > > >
> > > > > > >       $ImportModule();
> > > > > > >    };
> > > > > > >
> > > > > > > Does anyone see why the script tags are failing to load
> > > correctly? I have edited the path to the js files but ajile seems
to
> > > locate them just fine. I am at a loss?
> > > > > > >
> > > > > > >
> > > > > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > > Thanks for writing.
> > > > > > > >
> > > > > > > > I'm not sure what type of example you're looking for but
> I'll
> > > give an explanation of how Ajile works so you can decide if it
will
> meet
> > > your needs.
> > > > > > > >
> > > > > > > > When Ajile's Namespace function is used it creates a set
> of
> > > objects linked as properties of each other. For instance:
> > > > > > > >
> > > > > > > > Namespace ("my.name.space");
> > > > > > > >
> > > > > > > > Creates a global object "my" with a property called
> "name".
> > > The name property points to another object called "space".
> > > > > > > >
> > > > > > > > The my object and the name and space properties
contained
> > > within are immediately availble after calling the Namespace
> function.
> > > > > > > >
> > > > > > > > To load external script files you can use the Load,
> Import,
> > > ImportAs, or Include functions depending on your specific need.
> > > > > > > >
> > > > > > > > All of these functions will create a script tag within
> your
> > > HTML page when called, however the objects within the script
loaded
> via
> > > that tag won't be available for use until the code that called the
> Ajile
> > > function completes. If that's confusing, consider this example:
> > > > > > > >
> > > > > > > > Load ("some/script.js");  // contains var a=true;
> > > > > > > > alert (a);   // displays "undefined"
> > > > > > > >
> > > > > > > > To use the contents of script.js as soon as possible
> either
> > > use:
> > > > > > > >
> > > > > > > > Ajile.AddImportListener ("a", function(){
> > > > > > > >     alert (a);   //displays "true";
> > > > > > > > }));
> > > > > > > >
> > > > > > > > or if your code is in a script block in the HTML page
use
> > > separate script blocks for the loading and use of the external
> script's
> > > objects:
> > > > > > > >
> > > > > > > > [script]
> > > > > > > > Load ("some/script.js");   // contains var a=true;
> > > > > > > > [/script]
> > > > > > > >
> > > > > > > > [script]
> > > > > > > > alert (a);   // displays true
> > > > > > > > [/script]
> > > > > > > >
> > > > > > > > Hope that gives you a better idea of how Ajile works.
> > > > > > > >
> > > > > > > > Michael
> > > > > > > >
> > > > > > > > --- In ajile@yahoogroups.com, "destroyer019"
<omarotieku@>
> > > wrote:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --- In ajile@yahoogroups.com, "destroyer019"
> <omarotieku@>
> > > wrote:
> > > > > > > > > >
> > > > > > > > > > Hello,
> > > > > > > > > > I have intermediate javascript skills and I am new
to
> > > ajile. I am working on a project that will reference multiple
> javascript
> > > frameworks, such as Uize and VegUI, under one namespace to mix and
> match
> > > useful modules. Is it possible to use ajile to do this? If so
could
> > > someone give me a quick explanation of the process or an example?
> > > > > > > > > >
> > > > > > > > > Sorry, I meant to include this the first time. Here is
> what
> > > I have so far.
> > > > > > > > >
> > > > > > > > >  Namespace ("com.visualization.test");
> > > > > > > > >
> > > > > > > > >  var msg = typeof com.visualization.test ==
"undefined"
> > > > > > > > >          ? "Failed to create"
> > > > > > > > >          : "Successfully created";
> > > > > > > > >
> > > > > > > > >  alert(msg + " the [ com.visualization.test ]
> namespace!");
> > > > > > > > >
> > > > > > > > >  document.write('You are almost there!');
> > > > > > > > >
> > > > > > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > > > > > >
> > > > > > > > >    function testLoad()
> > > > > > > > >    {
> > > > > > > > >       if(  "undefined" != typeof Uize.Widget.Calendar)
{
> > > > > > > > >        alert("File was successfully loaded.");
> > > > > > > > >       }
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > > > > > >                 + "Failed to Load [
> Uize.Widget.Calendar.js
> > > ]");
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>

#260 From: "iskitzdev" <yahoo@...>
Date: Tue Nov 24, 2009 6:11 pm
Subject: Re: Import modules from javascript frameworks like Uize and Vegui?
iskitzdev
Send Email Send Email
 
Omar,
Good to hear. Glad you found the problem and solution.

Good luck!
Michael


--- In ajile@yahoogroups.com, "destroyer019" <omarotieku@...> wrote:
>
> Hey Michael,
> I found my problem. I was mistakenly trying to use the Import directive
> for a non namespaced script. Uize uses its own method to create and
> associate modules. I instead had to use Load to pull the appropriate
> scripts into my definied namespace. I can now create my prototype
> classes.
>
> Thanks for your help.
>
> --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@> wrote:
> >
> > Okay, so if I was to import from three other frameworks in this way,
> > would I then create a namespace for each of them to grab specific
> > functions from them? Then create a name space that brings them all
> > together? My goal is to create one package that abstracts the use the
> > other four javascript frameworks under one namespace.
> >
> > --- In ajile@yahoogroups.com, "mikeizworkin" mikeizworkin@ wrote:
> > >
> > > Hi Omar,
> > >
> > > Looking at the code you're using I'd recommend altering your
> index.js
> > file as follows:
> > >
> > >    Namespace ("com.newschool.piim");
> > >
> > >    // Define the Uize namespace's path:
> > >    Namespace ("Uize", "lib/UIZE_js/");
> > >
> > >    // Import Uize modules without needing to specify each path:
> > >    Import ("Uize.Widget.Page");
> > >    Import ("Uize.Widget.Calendar");
> > >    Import ("Uize.Templates.Calendar");
> > >
> > > If you prefer to use Import with specific paths you should only
> > specify the directory not the full file path and filename. Your import
> > statement should look similar to:
> > >
> > >    Import ("Uize.Widget.Page", "lib/UIZE_js/");
> > >
> > > Basically you can set the default path for an entire namespace using
> > the Namespace function with a directory path. For details see:
> > >
> > >    http://ajile.net/docs/api/Directives.htm#Namespace
> > >
> > > Using Namespace in this way sets the default path for all modules
> > within the specified namespace to the value you supplied. Later on
> when
> > you use Import, Include or ImportAs without specifying a directory
> path,
> > they will default to the location specified in the Namespace call.
> > >
> > > Hope that helps. Are you using the debug log to observe the paths
> > being used to load the Uize modules? I find it helpful when modules
> > don't seem to be loading as expected.
> > >
> > >
> > > Michael
> > >
> > > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > > >
> > > > Hello Michael,
> > > > I am trying to get Ajile to pull resources from the Uize
> > > > <http://www.uize.com>   library so I can then setup a prototype
> > class
> > > > that uses some methods from Uize and some custom methods in one
> > > > function. I have setup a namespace in the index.js file where i
> have
> > > > imported a few modules from the Uize framework. As a test, I have
> > setup
> > > > a calender widget from the Uize example page in my index.html,
> which
> > > > calls on these Uize modules. Ajile is pulling in the Uize modules
> > but
> > > > the calender widget is not being generated. Firebug gives me the
> > > > following warning…
> > > >
> > > > reference to undefined property BE[BF[BD]](function(AO){var
> > > > Ax,B,b,Z;if(typeof Ag!...,An=new AT(),AV=new AT();Ag()})("1.2.1")
> > > >
> > > > Am I wrong in using Ajile in this way? Here is the code I have
> > > > setup…
> > > >
> > > > <!-- index.html -->
> > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > > > "http://www.w3.org/TR/html4/strict.dtd">
> > > > <html>
> > > >      <head>
> > > >          <title>PVT</title>
> > > >          <link rel="stylesheet" href="css/page.css"/>
> > > >          <link rel="stylesheet" href="css/page.example.css"/>
> > > >          <link rel="stylesheet" href="css/widget.calendar.css"/>
> > > >
> > > >          <script type="text/javascript"
> > > > src="js/com.iskitz.ajile.js?cloakoff,debug"></script>
> > > >
> > > >      </head>
> > > >      <body>
> > > >          <script type="text/javascript">
> > > >
> > > > Uize.module ({
> > > >      required:[
> > > >          //'UizeDotCom.Page.Example.library',
> > > >          'Uize.Widget.Page',
> > > >          'Uize.Widget.Calendar',
> > > >          'Uize.Templates.Calendar'
> > > >      ],
> > > >      builder:function () {
> > > >          /*** create the example page widget ***/
> > > >              var page = window.page = new Uize.Widget.Page
> > > > /*({evaluator:function (code) {eval (code)}})*/;
> > > >
> > > >          /*** add the calendar child widget ***/
> > > >              var calendar = page.addChild (
> > > >                  'calendar',
> > > >                  Uize.Widget.Calendar,
> > > >                  {
> > > >                      built:false,
> > > >                      html:Uize.Templates.Calendar
> > > >                  }
> > > >              );
> > > >
> > > >          /*** wire up the page widget ***/
> > > >              page.wireUi ();
> > > >
> > > >          /*** some code for demonstrating the widget's
> programmatic
> > > > interface ***/
> > > >              function displayCalendarState () {
> > > >                  page.setNodeValue ('calendarValue',calendar.get
> > > > ('value'));
> > > >                  page.setNodeValue ('calendarMonth',calendar.get
> > > > ('month'));
> > > >                  page.setNodeValue ('calendarYear',calendar.get
> > > > ('year'));
> > > >              }
> > > >              calendar.wire ('Changed.value',displayCalendarState);
> > > >              calendar.wire ('Changed.month',displayCalendarState);
> > > >              calendar.wire ('Changed.year',displayCalendarState);
> > > >              displayCalendarState ();
> > > >      }
> > > > });
> > > >
> > > > </script>
> > > >      </body>
> > > > </html>
> > > >
> > > > <!-- The index.js file -->
> > > > Namespace ("com.newschool.piim");
> > > >
> > > > Import('Uize.Widget.Page', 'lib/UIZE_js/Uize.Widget.Page.js');
> > > >
> > > > Import('Uize.Widget.Calendar',
> > 'lib/UIZE_js/Uize.Widget.Calendar.js');
> > > >
> > > > Import('Uize.Templates.Calendar',
> > > > 'lib/UIZE_js/Uize.Templates.Calendar.js');
> > > >
> > > >
> > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > >
> > > > > Omar,
> > > > > Great to have a name ;-)
> > > > >
> > > > > Glad I could help you better understand Ajile.
> > > > >
> > > > > Best of luck,
> > > > > Michael
> > > > >
> > > > > --- In ajile@yahoogroups.com, "destroyer019" omarotieku@ wrote:
> > > > > >
> > > > > > Thanks Michael
> > > > > > My name is Omar, don't know why I didn't start with that. I
> will
> > try
> > > > out your suggestions, you are really good at clearing things up
> for
> > me.
> > > > > >
> > > > > > --- In ajile@yahoogroups.com, "mikeizworkin" <mikeizworkin@>
> > wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > > Do you have a name I can use when answering, it feels a bit
> > > > strange just saying hi every time :-)
> > > > > > >
> > > > > > > I understand the problem you're having and will go into how
> to
> > get
> > > > past that but as a first step please set Ajile's script tag's src
> > > > attribute to the following in your web page:
> > > > > > >
> > > > > > >    src="js/com.iskitz.ajile.js?cloakoff,debug,mvcshareoff"
> > > > > > >
> > > > > > > That will do the following things:
> > > > > > >
> > > > > > >    1. Disable Ajile's functionality that removes loaded
> > > > > > >       scripts from the page after they're no longer needed.
> > > > > > >
> > > > > > >    2. Turn on Ajile's debug mode. You can then use
> > Ajile.ShowLog()
> > > > > > >       within your code to see what's occurring as your code
> > > > executes.
> > > > > > >
> > > > > > >    3. Disable Ajile's automatic loading of the index.js file
> > > > > > >       that may exist in the same directory as the Ajile
> > script.
> > > > > > >
> > > > > > > Next, take a look at:
> > > > > > >
> > > > > > >
> > http://ajile.net/docs/api/Functions.htm#Ajile.AddImportListener
> > > > > > >
> > > > > > > When Importing scripts from within other script files you
> > should
> > > > use Ajile.AddImportListener to trigger the code that depends on
> your
> > > > imported scripts.
> > > > > > >
> > > > > > > The reason is that in browsers other than Opera, external
> > scripts
> > > > that load other scripts must complete their execution before the
> > > > imported scripts can be executed. This limitation is the reason
> why
> > the
> > > > Ajile.AddImportListener function exists. The function allows
> > delaying
> > > > execution of logic that depends on your imported script until the
> > > > imported script has been executed.
> > > > > > >
> > > > > > > Requesting an external script then immediately trying to use
> > it as
> > > > follows will fail without using the Ajile.AddImportListener
> > function:
> > > > > > >
> > > > > > >    Import ("my.cool.script");
> > > > > > >
> > > > > > >    my.cool.script.DoSomething();
> > > > > > >
> > > > > > > Instead try the following:
> > > > > > >
> > > > > > >    Import ("my.cool.script");
> > > > > > >
> > > > > > >    Ajile.AddImportListener ("my.cool.script", function
> > (module)
> > > > > > >    {
> > > > > > >       my.cool.script.DoSomething();
> > > > > > >    });
> > > > > > >
> > > > > > > The listener approach guarantees that the code that depends
> on
> > the
> > > > imported script will only be executed after that script has been
> > loaded
> > > > *and* executed.
> > > > > > >
> > > > > > > If you're someone who learns by example, I recommend taking
> a
> > look
> > > > at: the source code for:
> > > > > > >
> > > > > > >    http://ajile.net/examples/Examples.htm
> > > > > > >    http://ajile.net/examples/Examples.js
> > > > > > >
> > > > > > > Within those files you'll see a real world example of how
> > Ajile is
> > > > used to dynamically load external script files.
> > > > > > >
> > > > > > > Ajile's Overview and Documentation at the following links
> > should
> > > > also provide good information:
> > > > > > >
> > > > > > >    http://ajile.net/docs/Ajile-Overview.htm
> > > > > > >    http://ajile.net/docs/Ajile-Help.htm
> > > > > > >
> > > > > > > I hope these explanations help you better understand how
> Ajile
> > > > works and how it can be used.
> > > > > > >
> > > > > > >
> > > > > > > Michael
> > > > > > >
> > > > > > >
> > > > > > > --- In ajile@yahoogroups.com, "destroyer019" <omarotieku@>
> > wrote:
> > > > > > > >
> > > > > > > > Thanks for the reply Michael, I am beginning to work my
> way
> > > > around Ajile now. I am trying to successfully import a module but
> I
> > am
> > > > still experiencing a problem. I am following the import demo put
> > forth
> > > > in the documentation but after the alert telling me that the
> > namespace
> > > > has been created comes up the page seems to get stuck and does not
> > > > finishing loading, ever. I know that the imported module and its
> > > > functions will not be available to me until it loads, but I can't
> > seem
> > > > to reach that state. Firebug is giving me this message…
> > > > > > > >
> > > > > > > > Failed to load source for sourceFile scriptTag
> > file://index.js
> > > > script.tags( )
> > > > > > > >
> > > > > > > > Failed to load source for sourceFile scriptTag
> > > > file://js/com.visualization.test.example.ImportModule.js
> > script.tags( )
> > > > > > > >
> > > > > > > > my source code looks like this…
> > > > > > > >
> > > > > > > > <!-- index.html -->
> > > > > > > >
> > > > > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > > > "http://www.w3.org/TR/html4/strict.dtd">
> > > > > > > > <html>
> > > > > > > >  <head>
> > > > > > > >  <title>PVT</title>
> > > > > > > >  <script type="text/javascript"
> > > > src="js/com.iskitz.ajile.js"></script>
> > > > > > > >
> > > > > > > >  </head>
> > > > > > > >  <body>
> > > > > > > >
> > > > > > > >  </body>
> > > > > > > >
> > > > > > > > </html>
> > > > > > > >
> > > > > > > > /* index.js */
> > > > > > > >
> > > > > > > >  Namespace ("com.visualization.test");
> > > > > > > >
> > > > > > > >    var msg = typeof com.visualization.test == "undefined"
> > > > > > > >            ? "Failed to create"
> > > > > > > >            : "Successfully created";
> > > > > > > >
> > > > > > > >    alert(msg + " the [ com.visualization.test ]
> > namespace!");
> > > > > > > >
> > > > > > > >  com.visualization.test.Test = function() {
> > > > > > > >   document.write("I do not know why you don't work.");
> > > > > > > >  }
> > > > > > > >
> > > > > > > >
> > > > > > > >  Import ("com.visualization.test.example.ImportModule.*");
> > > > > > > >
> > > > > > > >    function testImportModule()
> > > > > > > >    {
> > > > > > > >       // Test if showContents method has been imported.
> > > > > > > >       var imported = "undefined" != typeof showContents;
> > > > > > > >
> > > > > > > >       if(imported)// Test if imported showContents is
> > > > ImportModule.showContents.
> > > > > > > >          if("undefined" != typeof
> > > > com.visualization.test.example.ImportModule)
> > > > > > > >             if(showContents ==
> > > > com.visualization.test.example.ImportModule.showContents)
> > > > > > > >                imported = true;
> > > > > > > >
> > > > > > > >       if(imported) showContents();
> > > > > > > >
> > > > > > > >       else alert( "ImportModule test was unsuccessful
> > :-(\n\n
> > > > Failed to "
> > > > > > > >                 + "Import [
> > > > com.visualization.test.example.ImportModule.* ]");
> > > > > > > >    }
> > > > > > > >
> > > > > > > > com.visualization.test.Test();
> > > > > > > >
> > > > > > > > /* com.visualization.test.example.ImportModule.js */
> > > > > > > >
> > > > > > > > Namespace ("com.visualization.test.example.ImportModule");
> > > > > > > >
> > > > > > > >    com.visualization.test.example.ImportModule =
> function()
> > > > > > > >    {
> > > > > > > >       var THIS = this;
> > > > > > > >
> > > > > > > >       // Constructor :: Creates public members.
> > > > > > > >       function $ImportModule()
> > > > > > > >       {
> > > > > > > >          this.aNumber            = 1;
> > > > > > > >          this.aString            = "member 5";
> > > > > > > >          this.aFunction          = function(){
> alert("member
> > > > 1"); };
> > > > > > > >          this.anArray            = ["member3"];
> > > > > > > >          this.anObject           = { member:"member 2" };
> > > > > > > >          this.aRegularExpression = (/member 6/);
> > > > > > > >          this.showContents       = showContents;
> > > > > > > >       }
> > > > > > > >
> > > > > > > >       function showContents()
> > > > > > > >       {
> > > > > > > >          var contents = ".:{
> > > > com.visualization.test.example.ImportModule }:.\n\n";
> > > > > > > >
> > > > > > > >          alert(contents + (THIS.constructor.toString ?
> > > > THIS.constructor : ''));
> > > > > > > >       }
> > > > > > > >
> > > > > > > >       $ImportModule();
> > > > > > > >    };
> > > > > > > >
> > > > > > > > Does anyone see why the script tags are failing to load
> > > > correctly? I have edited the path to the js files but ajile seems
> to
> > > > locate them just fine. I am at a loss?
> > > > > > > >
> > > > > > > >
> > > > > > > > --- In ajile@yahoogroups.com, "iskitzdev" <yahoo@> wrote:
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > > Thanks for writing.
> > > > > > > > >
> > > > > > > > > I'm not sure what type of example you're looking for but
> > I'll
> > > > give an explanation of how Ajile works so you can decide if it
> will
> > meet
> > > > your needs.
> > > > > > > > >
> > > > > > > > > When Ajile's Namespace function is used it creates a set
> > of
> > > > objects linked as properties of each other. For instance:
> > > > > > > > >
> > > > > > > > > Namespace ("my.name.space");
> > > > > > > > >
> > > > > > > > > Creates a global object "my" with a property called
> > "name".
> > > > The name property points to another object called "space".
> > > > > > > > >
> > > > > > > > > The my object and the name and space properties
> contained
> > > > within are immediately availble after calling the Namespace
> > function.
> > > > > > > > >
> > > > > > > > > To load external script files you can use the Load,
> > Import,
> > > > ImportAs, or Include functions depending on your specific need.
> > > > > > > > >
> > > > > > > > > All of these functions will create a script tag within
> > your
> > > > HTML page when called, however the objects within the script
> loaded
> > via
> > > > that tag won't be available for use until the code that called the
> > Ajile
> > > > function completes. If that's confusing, consider this example:
> > > > > > > > >
> > > > > > > > > Load ("some/script.js");  // contains var a=true;
> > > > > > > > > alert (a);   // displays "undefined"
> > > > > > > > >
> > > > > > > > > To use the contents of script.js as soon as possible
> > either
> > > > use:
> > > > > > > > >
> > > > > > > > > Ajile.AddImportListener ("a", function(){
> > > > > > > > >     alert (a);   //displays "true";
> > > > > > > > > }));
> > > > > > > > >
> > > > > > > > > or if your code is in a script block in the HTML page
> use
> > > > separate script blocks for the loading and use of the external
> > script's
> > > > objects:
> > > > > > > > >
> > > > > > > > > [script]
> > > > > > > > > Load ("some/script.js");   // contains var a=true;
> > > > > > > > > [/script]
> > > > > > > > >
> > > > > > > > > [script]
> > > > > > > > > alert (a);   // displays true
> > > > > > > > > [/script]
> > > > > > > > >
> > > > > > > > > Hope that gives you a better idea of how Ajile works.
> > > > > > > > >
> > > > > > > > > Michael
> > > > > > > > >
> > > > > > > > > --- In ajile@yahoogroups.com, "destroyer019"
> <omarotieku@>
> > > > wrote:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --- In ajile@yahoogroups.com, "destroyer019"
> > <omarotieku@>
> > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hello,
> > > > > > > > > > > I have intermediate javascript skills and I am new
> to
> > > > ajile. I am working on a project that will reference multiple
> > javascript
> > > > frameworks, such as Uize and VegUI, under one namespace to mix and
> > match
> > > > useful modules. Is it possible to use ajile to do this? If so
> could
> > > > someone give me a quick explanation of the process or an example?
> > > > > > > > > > >
> > > > > > > > > > Sorry, I meant to include this the first time. Here is
> > what
> > > > I have so far.
> > > > > > > > > >
> > > > > > > > > >  Namespace ("com.visualization.test");
> > > > > > > > > >
> > > > > > > > > >  var msg = typeof com.visualization.test ==
> "undefined"
> > > > > > > > > >          ? "Failed to create"
> > > > > > > > > >          : "Successfully created";
> > > > > > > > > >
> > > > > > > > > >  alert(msg + " the [ com.visualization.test ]
> > namespace!");
> > > > > > > > > >
> > > > > > > > > >  document.write('You are almost there!');
> > > > > > > > > >
> > > > > > > > > >  Load ("lib/UIZE_js/Uize.Widget.Calendar.js");
> > > > > > > > > >
> > > > > > > > > >    function testLoad()
> > > > > > > > > >    {
> > > > > > > > > >       if(  "undefined" != typeof Uize.Widget.Calendar)
> {
> > > > > > > > > >        alert("File was successfully loaded.");
> > > > > > > > > >       }
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >       else alert( "Load test was unsuccessful :-(\n\n"
> > > > > > > > > >                 + "Failed to Load [
> > Uize.Widget.Calendar.js
> > > > ]");
> > > > > > > > > >    }
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > >
> >
>

#270 From: "strukturgewitter" <strukturgewitter@...>
Date: Tue Mar 16, 2010 11:07 am
Subject: Re: Problem using the directory-based approach
strukturgewi...
Send Email Send Email
 
Hi, im digging up this post because i experience a very similar problem.
My file structure is like this:
/var/www/test/index.html
/var/www/test/com/iskitz/ajile.js (to activate directory base approach)
/var/www/test/index.js
/var/www/test/com/testsite/page/sidebar/Test.js
/var/www/test/com/testsite/page/sidebar/Test2.js

File contains:
------index.js------
Include('com.testsite.page.sidebar.Test2');
Ajile.AddImportListener('com.tessite.page.sidebar.Test2', function(name) {
   com.testsite.page.sidebar.Test2();
});
------Test.js------
Namespace('com.testsite.page.sidebar');

com.testsite.page.sidebar.Test = function() {
   alert("Hello World");
}
------Test2.js------
Namespace('com.testsite.page.sidebar');

com.testsite.page.sidebar.Test2 = function() {
   Include('com.testsite.page.sidebar.Test');
   Ajile.AddImportListener('com.testsite.page.sidebar.Test', function(name) {
     com.testsite.page.sidebar.Test();
   });
}
------index.html------
<html>
<head>
    <script src="com/iskitz/ajile.js?cloakoff?mvcoff"
type="text/javascript"></script>
</head>
<body>Test</body>
</html>
----------------------

When i load my page, nothing happens (i also know why [see below])

This is what firebug gives me:
<html>
   <head>
     <meta http-equiv="Powered by Ajile 1.2.1" content="ajile.iskitz.com :: Smart
scripts that play nice ">
     <script title="index" type="text/javascript"
src="http://localhost/test/index.js"></script>
     <script title="com.testsite.page.sidebar.Test2" type="text/javascript"
src="http://localhost/test/com.testsite.page.sidebar.Test2.js"></script>
     <script title="com.testsite.page.sidebar.Test2"
type="text/javascript">ImportAs("com.testsite.page.sidebar.Test2",
"com.testsite.page.sidebar.Test2");</script>
   </head>
   <body>Test</body>
</html>

The Problem is the following line:
http://localhost/test/com.testsite.page.sidebar.Test2.js

This not a directory based approach.. i assume

Is there any way around this _without_ using
Namespace('my.space', null, '/');
?

#271 From: "mikeizworkin" <mikeizworkin@...>
Date: Tue Mar 16, 2010 10:13 pm
Subject: Re: Problem using the directory-based approach
mikeizworkin
Send Email Send Email
 
Hi,

Thanks for providing so much info about the problem you've run into. Before I go
into a full explanation, the short answer for your specific code is to make the
following changes:

	 //------index.html------
	 ... src = "com/iskitz/ajile.js?cloakoff,mvcshareoff" ...

	 //------index.js------
	 Include ("com.testsite.page.sidebar.Test2", null, '/');


The above line will cause the "com.testsite.page.sidebar" namespace to default
to directory-based loading for that and all subsequent Include, Import, and
ImportAs of modules using that namespace. After the line above executes any of
the following will trigger directory-based loading:


	 Include ("com.testsite.page.sidebar.Test");
	 Include ("com.testsite.page.sidebar.more.nesting.SomeModule");


More detail. Namespace, Import, ImportAs, and include can all be used to define
the loading style (directory or file) for a given namespace.

The third parameter in the following statement indicates which character Ajile
should use to translate the specified Namespace from dot-notation to its
file-system representation.


	 Namespace ("your.name.space", "/optional/location/", '/');

	 Import ("your.Module", "/optional/location/", '/');

	 ImportAs ("Module", "your.Module", "/optional/location/", '/'); // fourth
parameter here

	 Include ("your.Module", "/optional/location/", '/');


Using Include, Import or ImportAs with any module within the same or a nested
namespace will cause it to be loaded from: /optional/location/your/name/space/

Substituting '.' for '/' is equivalent to file-based loading using dot-notation.

For details see:

	 http://ajile.net/docs/api/Directives.htm#Import
	 http://ajile.net/docs/api/Directives.htm#ImportAs
	 http://ajile.net/docs/api/Directives.htm#Include
	 http://ajile.net/docs/api/Directives.htm#Namespace


You might also find it useful to use the "debug" load-time option to get more
information about Ajile's operations. When working in an environment that
supports console.* (i.e. Firebug) you'll be able to observe Ajile's sequence of
actions. This also works with WebKit's console. In environments without console
support you can explicitly use Ajile.ShowLog() to display information about
Ajile's operations. Ajile.ShowLog() requires pop-up blocking to be disabled.

To use multiple load-time options use the following syntax:

	 ... src = "com/iskitz/ajile.js?option1,option2,option3" ...

The following will cause Ajile to disable module cloaking, enable debugging
(console.*), and disable automatically loading an index.js file from the same
location as com.iskitz.ajile.

	 ...src="com/iskitz/ajile.js?cloakoff,debug,mvcshareoff"...

For more load-time option info see:

	 http://ajile.net/docs/api/Options.htm


Hope that helps. Definitely post any further questions or additional issues you
run into.


-Michael


--- In ajile@yahoogroups.com, "strukturgewitter" <strukturgewitter@...> wrote:
>
> Hi, im digging up this post because i experience a very similar problem.
> My file structure is like this:
> /var/www/test/index.html
> /var/www/test/com/iskitz/ajile.js (to activate directory base approach)
> /var/www/test/index.js
> /var/www/test/com/testsite/page/sidebar/Test.js
> /var/www/test/com/testsite/page/sidebar/Test2.js
>
> File contains:
> ------index.js------
> Include('com.testsite.page.sidebar.Test2');
> Ajile.AddImportListener('com.tessite.page.sidebar.Test2', function(name) {
>   com.testsite.page.sidebar.Test2();
> });
> ------Test.js------
> Namespace('com.testsite.page.sidebar');
>
> com.testsite.page.sidebar.Test = function() {
>   alert("Hello World");
> }
> ------Test2.js------
> Namespace('com.testsite.page.sidebar');
>
> com.testsite.page.sidebar.Test2 = function() {
>   Include('com.testsite.page.sidebar.Test');
>   Ajile.AddImportListener('com.testsite.page.sidebar.Test', function(name) {
>     com.testsite.page.sidebar.Test();
>   });
> }
> ------index.html------
> <html>
> <head>
>    <script src="com/iskitz/ajile.js?cloakoff?mvcoff"
type="text/javascript"></script>
> </head>
> <body>Test</body>
> </html>
> ----------------------
>
> When i load my page, nothing happens (i also know why [see below])
>
> This is what firebug gives me:
> <html>
>   <head>
>     <meta http-equiv="Powered by Ajile 1.2.1" content="ajile.iskitz.com ::
Smart scripts that play nice ">
>     <script title="index" type="text/javascript"
src="http://localhost/test/index.js"></script>
>     <script title="com.testsite.page.sidebar.Test2" type="text/javascript"
src="http://localhost/test/com.testsite.page.sidebar.Test2.js"></script>
>     <script title="com.testsite.page.sidebar.Test2"
type="text/javascript">ImportAs("com.testsite.page.sidebar.Test2",
"com.testsite.page.sidebar.Test2");</script>
>   </head>
>   <body>Test</body>
> </html>
>
> The Problem is the following line:
> http://localhost/test/com.testsite.page.sidebar.Test2.js
>
> This not a directory based approach.. i assume
>
> Is there any way around this _without_ using
> Namespace('my.space', null, '/');
> ?
>

Messages 221 - 271 of 301   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help