mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Add package event that is fired for each installed/uninstalled package.
This commit is contained in:
@@ -144,7 +144,10 @@ module.exports = function (names, options) {
|
||||
|
||||
var uninstall = function () {
|
||||
async.forEach(uninstallables, function (pkg, next) {
|
||||
pkg.on('uninstall', next).uninstall();
|
||||
pkg.on('uninstall', function () {
|
||||
emitter.emit('package', pkg);
|
||||
next();
|
||||
}).uninstall();
|
||||
}, function () {
|
||||
// Finally save
|
||||
if (options.save) save();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
// http://opensource.org/licenses/MIT
|
||||
// ==========================================
|
||||
// Events:
|
||||
// - install: fired when package installed
|
||||
// - install: fired when everything is installed
|
||||
// - package: fired for each installed packaged
|
||||
// - resolve: fired when deps resolved (with a true/false indicating success or error)
|
||||
// - error: fired on all errors
|
||||
// - data: fired when trying to output data
|
||||
@@ -191,7 +192,10 @@ Manager.prototype.prune = function () {
|
||||
Manager.prototype.install = function () {
|
||||
async.forEach(Object.keys(this.dependencies), function (name, next) {
|
||||
var pkg = this.dependencies[name][0];
|
||||
pkg.once('install', next).install();
|
||||
pkg.once('install', function () {
|
||||
this.emit('package', pkg);
|
||||
next();
|
||||
}.bind(this)).install();
|
||||
pkg.once('error', next);
|
||||
}.bind(this), function () {
|
||||
if (this.errors.length) this.reportErrors();
|
||||
|
||||
Reference in New Issue
Block a user