5
5
These objects are available in all modules. Some of these objects aren't
6
6
actually in the global scope but in the module scope - this will be noted.
7
7
8
- ## global
9
-
10
- <!-- type=global -->
11
-
12
- * {Object} The global namespace object.
13
-
14
- In browsers, the top-level scope is the global scope. That means that in
15
- browsers if you're in the global scope ` var something ` will define a global
16
- variable. In Node.js this is different. The top-level scope is not the global
17
- scope; ` var something ` inside an Node.js module will be local to that module.
18
-
19
- ## process
20
-
21
- <!-- type=global -->
22
-
23
- * {Object}
24
-
25
- The process object. See the [ process object] [ ] section.
26
-
27
- ## console
28
-
29
- <!-- type=global -->
30
-
31
- * {Object}
32
-
33
- Used to print to stdout and stderr. See the [ console] [ ] section.
34
-
35
8
## Class: Buffer
36
9
37
10
<!-- type=global -->
@@ -40,48 +13,20 @@ Used to print to stdout and stderr. See the [console][] section.
40
13
41
14
Used to handle binary data. See the [ buffer section] [ ]
42
15
43
- ## require()
16
+ ## __ dirname
44
17
45
18
<!-- type=var -->
46
19
47
- * {Function}
48
-
49
- To require modules. See the [ Modules] [ ] section. ` require ` isn't actually a
50
- global but rather local to each module.
51
-
52
- ### require.resolve()
53
-
54
- Use the internal ` require() ` machinery to look up the location of a module,
55
- but rather than loading the module, just return the resolved filename.
56
-
57
- ### require.cache
58
-
59
- * {Object}
60
-
61
- Modules are cached in this object when they are required. By deleting a key
62
- value from this object, the next ` require ` will reload the module.
63
-
64
- ### require.extensions
65
-
66
- Stability: 0 - Deprecated
67
-
68
- * {Object}
69
-
70
- Instruct ` require ` on how to handle certain file extensions.
20
+ * {String}
71
21
72
- Process files with the extension ` .sjs ` as ` .js ` :
22
+ The name of the directory that the currently executing script resides in.
73
23
74
- require.extensions['.sjs'] = require.extensions['.js'];
24
+ Example: running ` node example.js ` from ` /Users/mjr `
75
25
76
- ** Deprecated** In the past, this list has been used to load
77
- non-JavaScript modules into Node.js by compiling them on-demand.
78
- However, in practice, there are much better ways to do this, such as
79
- loading modules via some other Node.js program, or compiling them to
80
- JavaScript ahead of time.
26
+ console.log(__dirname);
27
+ // /Users/mjr
81
28
82
- Since the Module system is locked, this feature will probably never go
83
- away. However, it may have subtle bugs and complexities that are best
84
- left untouched.
29
+ ` __dirname ` isn't actually a global but rather local to each module.
85
30
86
31
## __ filename
87
32
@@ -101,21 +46,57 @@ Example: running `node example.js` from `/Users/mjr`
101
46
102
47
` __filename ` isn't actually a global but rather local to each module.
103
48
104
- ## __ dirname
49
+ ## clearInterval(t)
50
+
51
+ Stop a timer that was previously created with ` setInterval() ` . The callback
52
+ will not execute.
53
+
54
+ <!-- type=global-->
55
+
56
+ The timer functions are global variables. See the [ timers] [ ] section.
57
+
58
+ [ buffer section ] : buffer.html
59
+ [ module system documentation ] : modules.html
60
+ [ Modules ] : modules.html#modules_modules
61
+ [ process object ] : process.html#process_process
62
+ [ console ] : console.html
63
+ [ timers ] : timers.html
64
+
65
+ ## clearTimeout(t)
66
+
67
+ Stop a timer that was previously created with ` setTimeout() ` . The callback will
68
+ not execute.
69
+
70
+ ## console
71
+
72
+ <!-- type=global -->
73
+
74
+ * {Object}
75
+
76
+ Used to print to stdout and stderr. See the [ console] [ ] section.
77
+
78
+ ## exports
105
79
106
80
<!-- type=var -->
107
81
108
- * {String}
82
+ A reference to the ` module.exports ` that is shorter to type.
83
+ See [ module system documentation] [ ] for details on when to use ` exports ` and
84
+ when to use ` module.exports ` .
109
85
110
- The name of the directory that the currently executing script resides in .
86
+ ` exports ` isn't actually a global but rather local to each module .
111
87
112
- Example: running ` node example.js ` from ` /Users/mjr `
88
+ See the [ module system documentation ] [ ] for more information.
113
89
114
- console.log(__dirname);
115
- // /Users/mjr
90
+ ## global
116
91
117
- ` __dirname ` isn't actually a global but rather local to each module.
92
+ <!-- type=global -->
93
+
94
+ * {Object} The global namespace object.
118
95
96
+ In browsers, the top-level scope is the global scope. That means that in
97
+ browsers if you're in the global scope ` var something ` will define a global
98
+ variable. In Node.js this is different. The top-level scope is not the global
99
+ scope; ` var something ` inside an Node.js module will be local to that module.
119
100
120
101
## module
121
102
@@ -131,33 +112,56 @@ available through `require()`.
131
112
132
113
See the [ module system documentation] [ ] for more information.
133
114
134
- ## exports
115
+ ## process
116
+
117
+ <!-- type=global -->
118
+
119
+ * {Object}
120
+
121
+ The process object. See the [ process object] [ ] section.
122
+
123
+ ## require()
135
124
136
125
<!-- type=var -->
137
126
138
- A reference to the ` module.exports ` that is shorter to type.
139
- See [ module system documentation] [ ] for details on when to use ` exports ` and
140
- when to use ` module.exports ` .
127
+ * {Function}
141
128
142
- ` exports ` isn't actually a global but rather local to each module.
129
+ To require modules. See the [ Modules] [ ] section. ` require ` isn't actually a
130
+ global but rather local to each module.
143
131
144
- See the [ module system documentation ] [ ] for more information.
132
+ ### require.cache
145
133
146
- ## setTimeout(cb, ms)
134
+ * {Object}
147
135
148
- Run callback ` cb ` after * at least * ` ms ` milliseconds. The actual delay depends
149
- on external factors like OS timer granularity and system load .
136
+ Modules are cached in this object when they are required. By deleting a key
137
+ value from this object, the next ` require ` will reload the module .
150
138
151
- The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
152
- outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
153
- cannot span more than 24.8 days.
139
+ ### require.extensions
154
140
155
- Returns an opaque value that represents the timer.
141
+ Stability: 0 - Deprecated
156
142
157
- ## clearTimeout(t)
143
+ * {Object}
158
144
159
- Stop a timer that was previously created with ` setTimeout() ` . The callback will
160
- not execute.
145
+ Instruct ` require ` on how to handle certain file extensions.
146
+
147
+ Process files with the extension ` .sjs ` as ` .js ` :
148
+
149
+ require.extensions['.sjs'] = require.extensions['.js'];
150
+
151
+ ** Deprecated** In the past, this list has been used to load
152
+ non-JavaScript modules into Node.js by compiling them on-demand.
153
+ However, in practice, there are much better ways to do this, such as
154
+ loading modules via some other Node.js program, or compiling them to
155
+ JavaScript ahead of time.
156
+
157
+ Since the Module system is locked, this feature will probably never go
158
+ away. However, it may have subtle bugs and complexities that are best
159
+ left untouched.
160
+
161
+ ### require.resolve()
162
+
163
+ Use the internal ` require() ` machinery to look up the location of a module,
164
+ but rather than loading the module, just return the resolved filename.
161
165
162
166
## setInterval(cb, ms)
163
167
@@ -171,18 +175,13 @@ cannot span more than 24.8 days.
171
175
172
176
Returns an opaque value that represents the timer.
173
177
174
- ## clearInterval(t)
175
-
176
- Stop a timer that was previously created with ` setInterval() ` . The callback
177
- will not execute.
178
+ ## setTimeout(cb, ms)
178
179
179
- <!-- type=global-->
180
+ Run callback ` cb ` after * at least* ` ms ` milliseconds. The actual delay depends
181
+ on external factors like OS timer granularity and system load.
180
182
181
- The timer functions are global variables. See the [ timers] [ ] section.
183
+ The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
184
+ outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
185
+ cannot span more than 24.8 days.
182
186
183
- [ buffer section ] : buffer.html
184
- [ module system documentation ] : modules.html
185
- [ Modules ] : modules.html#modules_modules
186
- [ process object ] : process.html#process_process
187
- [ console ] : console.html
188
- [ timers ] : timers.html
187
+ Returns an opaque value that represents the timer.
0 commit comments