Last active
August 30, 2016 12:05
-
-
Save chrispsn/95a5c9d87e3880c7d51a85f622a389a9 to your computer and use it in GitHub Desktop.
Google Closure in JScript. I can't believe this works
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 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