From d457a952eceb1698b2d71f5d9ec80736be423824 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 24 Sep 2017 00:56:08 +0200 Subject: ... --- orig/pq-web/sim.js | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) (limited to 'orig/pq-web') diff --git a/orig/pq-web/sim.js b/orig/pq-web/sim.js index 2b0b5a7..a6e4976 100644 --- a/orig/pq-web/sim.js +++ b/orig/pq-web/sim.js @@ -75,31 +75,23 @@ $.each = function (object, callback) { var document = null; -if (typeof process !== "undefined") { - // Node - var fs = require("fs"); - var load = function (filename) { - var content = fs.readFileSync(filename); - require("vm").runInThisContext(content, filename); - //global.eval.call(global, String(content)); - }; - var print = function () { - args = Array.prototype.slice.call(arguments); - console.log(args.join(" ")); - }; - var read = function (f) { return fs.readFileSync(f); }; - var write = function (f,c) { fs.writeFileSync(f,c); }; - - global.window = window; - global.document = document; - global.navigator = navigator; - global.$ = $; - print("node"); -} else { - // V8 shell - global = this; - print("v8"); -} +var fs = require("fs"); +var load = function (filename) { + var content = fs.readFileSync(filename); + require("vm").runInThisContext(content, filename); + //global.eval.call(global, String(content)); +}; +var print = function () { + args = Array.prototype.slice.call(arguments); + console.log(args.join(" ")); +}; +var read = function (f) { return fs.readFileSync(f); }; +var write = function (f,c) { fs.writeFileSync(f,c); }; + +global.window = window; +global.document = document; +global.navigator = navigator; +global.$ = $; var alert = global.alert = function (m) { print("ALERT: " + m); }; -- cgit v1.2.3