Skip to content
Permalink
Browse files

src: deprecate undocumented variables

The `root` and `GLOBAL` were never documented.

PR-URL: #1838
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information...
JacksonTian authored and bnoordhuis committed May 29, 2015
1 parent b212be0 commit 4e4693140698eeb1b45e682a577142bcde2bd7be
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/node.js
@@ -222,8 +222,27 @@
startup.globalVariables = function() {
global.process = process;
global.global = global;
global.GLOBAL = global;
global.root = global;
const util = NativeModule.require('util');

// Deprecate GLOBAL and root
['GLOBAL', 'root'].forEach(function(name) {
// getter
const get = util.deprecate(function() {
return this;
}, `'${name}' is deprecated, use 'global'`);
// setter
const set = util.deprecate(function(value) {
Object.defineProperty(this, name, {
configurable: true,
writable: true,
enumerable: true,
value: value
});
}, `'${name}' is deprecated, use 'global'`);
// define property
Object.defineProperty(global, name, { get, set, configurable: true });
});

global.Buffer = NativeModule.require('buffer').Buffer;
process.domain = null;
process._exiting = false;

0 comments on commit 4e46931

Please sign in to comment.
You can’t perform that action at this time.