Skip to content

Commit

Permalink
src: deprecate undocumented variables
Browse files Browse the repository at this point in the history
The `root` and `GLOBAL` never be documented.
  • Loading branch information
JacksonTian committed May 30, 2015
1 parent 2c686fd commit e2d8bf4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,17 @@
startup.globalVariables = function() {
global.process = process;
global.global = global;
global.GLOBAL = global;
global.root = global;

// Deprecate GLOBAL and root
const holders = {GLOBAL: global, root: global};
['GLOBAL', 'root'].forEach(function (name) {
const access = NativeModule.require('util').deprecate(function(val) {
if (val) holders[name] = val;
return holders[name];
}, "'" + name + "' is deprecated, use 'global'");
Object.defineProperty(global, name, {get: access, set: access});
});

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

0 comments on commit e2d8bf4

Please sign in to comment.