Skip to content

Instantly share code, notes, and snippets.

@chrispsn
Last active August 30, 2016 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrispsn/95a5c9d87e3880c7d51a85f622a389a9 to your computer and use it in GitHub Desktop.
Save chrispsn/95a5c9d87e3880c7d51a85f622a389a9 to your computer and use it in GitHub Desktop.
Google Closure in JScript. I can't believe this works
function get_text_in_file(filepath) {
var FS = new ActiveXObject("Scripting.FileSystemObject");
return FS.OpenTextFile(filepath, 1).ReadAll(); // 1 = for reading
}
function require(filepath) {
eval(get_text_in_file(filepath));
return true;
}
// base.js sets up the goog.global namespace
var BASE_DIR = "closure-library-master\\closure\\goog\\";
eval(get_text_in_file(BASE_DIR + "base.js"));
require(BASE_DIR + "deps.js");
goog.global.CLOSURE_IMPORT_SCRIPT = require;
goog.basePath = BASE_DIR
goog.require("goog.crypt.base64");
var result = goog.crypt.base64.encodeString("TEST");
WScript.echo(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment