Created
May 2, 2011 17:11
-
-
Save jfsiii/951935 to your computer and use it in GitHub Desktop.
Function I run when Express starts up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preloadFlot() | |
{ | |
var jsdom = require("jsdom"), | |
document = jsdom.jsdom(), | |
window = document.createWindow(), | |
flot_location = 'http://jsno.de/javascripts/jquery.flot.svn.js', | |
text_location = 'http://jsno.de/javascripts/jquery.flot.text.js', | |
jquery_location = 'http://code.jquery.com/jquery-1.5.min.js', | |
loadScript = function ( location, callback ) | |
{ | |
var script = document.createElement("script"); | |
script.src = location; | |
if (callback) script.onload = callback; | |
document.head.appendChild(script); | |
return script; | |
}; | |
window.Canvas = require('canvas'); | |
loadScript(jquery_location, function (){ | |
global.jQuery = window.$; | |
loadScript(flot_location, function () { loadScript(text_location); }); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment