Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
events: cache domain module locally
It's faster than calling `require` every time we create an
`EventEmitter`.
  • Loading branch information
mmalecki authored and isaacs committed Jun 17, 2012
1 parent 71a2a2c commit 3db2e03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/events.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3db2e03

Please sign in to comment.