Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
make the npm object an EventEmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Oct 29, 2010
1 parent db9ee01 commit d76eb9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions npm.js
Expand Up @@ -9,7 +9,8 @@ if (require.main === module) {
process.exit(1)
}

var npm = exports
var EventEmitter = require("events").EventEmitter
, npm = module.exports = new EventEmitter
, config = require("./lib/config")
, set = require("./lib/utils/set")
, get = require("./lib/utils/get")
Expand Down Expand Up @@ -90,12 +91,11 @@ Object.keys(abbrevs).forEach(function (c) {
})

var loaded = false
npm.load = function (conf, cb) {
if (!cb && typeof conf === "function") cb = conf , conf = {}
npm.load = function (conf, cb_) {
if (!cb_ && typeof conf === "function") cb_ = conf , conf = {}
function cb (er) { return cb_(er, npm) }
if (loaded) return cb()
loaded = true
// don't assume that npm is installed in any particular spot, since this
// might conceivably be a bootstrap attempt.
log.waitForConfig()
ini.resolveConfigs(conf, function (er) {
if (er) return cb(er)
Expand Down

0 comments on commit d76eb9f

Please sign in to comment.