setTimeout, async script loading, and head.js

189 views
Skip to first unread message

Aaron Gibralter

unread,
Feb 7, 2011, 12:01:58 PM2/7/11
to johnso...@googlegroups.com
Is there anyway to test scripts that load other scripts asynchronously with head.js(...)?

script 1:
    // ...
    head.js("/path/to/script2.js", "/path/to/script3.js", callback);
    // ...

I want to test the functionality in the callback function, but it depends on having script2 and script3 loaded.

Steven Parkes

unread,
Feb 7, 2011, 12:17:41 PM2/7/11
to johnso...@googlegroups.com

You could try something like envjs (https://github.com/smparkes/env-js) or try to pull the timer code from there.

setTimeout is part of the browser environment, not part of javascript.

Aaron Gibralter

unread,
Feb 7, 2011, 1:21:58 PM2/7/11
to johnso...@googlegroups.com
But doesn't Johnson already use Envjs? Shouldn't Johnson load env.js's setTimeout code?

Aaron Gibralter

unread,
Feb 7, 2011, 1:28:53 PM2/7/11
to johnso...@googlegroups.com
Ohh sorry, I'm thinking about Harmony... Harmony combines johnson and envjs...
Reply all
Reply to author
Forward
0 new messages