Ebeo / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

GData API does not work with server side javascript framewors #467

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to execute www.google.com/jsapi in a server side environment (like 
Node.js)
2. Dependencies on windows and document break execution.

What is the expected output? What do you see instead?
The window issue is simple enough I just did this:

var global.window = global; 
loadAndExecuteJSAPIScript();

However you are using the document object to load script files and this is a 
little harder to 'mock'.  It would be ideal if you added an extension point 
into jsapi where I can hook my own load script function.  I.e:

google.loader2.loadScript = function(src, callback) {
  // Your code here
};

I could then just make my own implementation of this for my corresponding 
framework.

Note: you would also need to give the developer time/namespace to mock this 
(Hence the 'loader2' namespace above).  I.e. Currently you do not execute the 
code if google.loader already exists, so there needs to be a way of providing 
the mock before the heavy processing/loading of libs starts (most probably just 
another callback).

Thanks

Guido

Original issue reported on code.google.com by guido.tapia@gmail.com on 16 Jan 2011 at 1:37