2005/08/12 09:39: Emulating Ruby's require method in JavaScript

function require(url) { var a = new XMLHttpRequest(); a.open("GET", url, false); a.send(null); eval(a.responseText); }

Allowing it to be loaded asynchronously would be nicer, but it doesn't match the simplicity of Ruby's require nearly so neatly then.

Comments