W3C home > Mailing lists > Public > www-svg@w3.org > March 2004

Sync. network operation and JavaScript's lack of having modules

From: Jan-Klaas Kollhof <keyjaque@yahoo.com>
Date: Wed, 17 Mar 2004 01:58:17 -0800 (PST)
Message-ID: <20040317095817.10913.qmail@web60104.mail.yahoo.com>
To: www-svg@w3.org


I have mentioned this a fiew times.
I would like to have sync. network operation.
I have heard the concers about UA blocking.
But they have yet not convinsed me :).

One thing I need sync network for is to dynamically
load javascript. This allows a more modularized
JavaScript does not have packages or
modules(JavaScript 2 will maybe!!!)
If it would it would need sync network underneath to
load them when required.

here an example:

   //do something
   var logger = importModule("logger");
   logger.append("there was an unusual error");
//more code

The logger.js is only loaded if the condition is
otherwise the code is never loaded.
This works nicely in IE and Moz just not in SVG.
Yes this could be rewritten to use async connections
using callbacks:

  //do something
   importModule("logger", function(logger){
       logger.append("there was a prob");
//more code now executed before logger :(

This is not pretty(in more than one way).

A whole module that imports ohters would look like:

m1 = importModule("m1")
m2 = importModule("m2")
//module code

and for async:
importModule("m1" function(m1){
importModule("m1" function(m2){
     //module code here

the async approch does not work all the time though

I am getting around this problem by just referencing
all scripts that MIGHT be used in my SVG.

Another reason is RPC. Sometimes I would like to be
able to do sync rpc calls. 


Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
Received on Wednesday, 17 March 2004 04:58:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:00 UTC