projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
71a2a2c
)
events: cache `domain` module locally
author
Maciej Małecki
<maciej.malecki@notimplemented.org>
Sun, 17 Jun 2012 09:50:40 +0000
(11:50 +0200)
committer
isaacs
<i@izs.me>
Sun, 17 Jun 2012 20:07:20 +0000
(13:07 -0700)
It's faster than calling `require` every time we create an
`EventEmitter`.
lib/events.js
patch
|
blob
|
history
diff --git
a/lib/events.js
b/lib/events.js
index
fe7c048
..
7e219a1
100644
(file)
--- a/
lib/events.js
+++ b/
lib/events.js
@@
-20,11
+20,12
@@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var isArray = Array.isArray;
+var domain;
function EventEmitter() {
if (exports.usingDomains) {
// if there is an active domain, then attach to it.
-
var domain =
require('domain');
+
domain = domain ||
require('domain');
if (domain.active && !(this instanceof domain.Domain)) {
this.domain = domain.active;
}