/**
 * Meters number of invocations of window.alert, window.confirm, and
 * window.prompt.
 */

exports.version = '0.1';

exports.module = function(phantomas) {
	var alerts = [],
		confirms = [],
		prompts = [];

	phantomas.on('alert', function(msg) {
		alerts.push(msg);
	});

	phantomas.on('confirm', function(msg) {
		confirms.push(msg);
	});

	phantomas.on('prompt', function(msg) {
		prompts.push(msg);
	});

	phantomas.on('report', function() {
		phantomas.setMetric('windowAlerts', alerts.length);
		phantomas.setMetric('windowConfirms', confirms.length);
		phantomas.setMetric('windowPrompts', prompts.length);

		notifyWhenPresent(alerts, 'alert');
		notifyWhenPresent(confirms, 'confirm');
		notifyWhenPresent(prompts, 'prompt');
	});

	function notifyWhenPresent(array, nameOfWindowFn) {
		var len = array.length;
		if (len > 0) {
			phantomas.addNotice('window.' + nameOfWindowFn + ' (' + len + '):');
			array.forEach(function(msg) {
				phantomas.addNotice(' ' + msg);
			});
			phantomas.addNotice(); // Extra Line
		}
	}
};

/**
 * Meters number of invocations of window.alert, window.confirm, and
 * window.prompt.
 */

exports.version = '0.1';

exports.module = function(phantomas) {
	var alerts = [],
		confirms = [],
		prompts = [];

	phantomas.on('alert', function(msg) {
		alerts.push(msg);
	});

	phantomas.on('confirm', function(msg) {
		confirms.push(msg);
	});

	phantomas.on('prompt', function(msg) {
		prompts.push(msg);
	});

	phantomas.on('report', function() {
		phantomas.setMetric('windowAlerts', alerts.length);
		phantomas.setMetric('windowConfirms', confirms.length);
		phantomas.setMetric('windowPrompts', prompts.length);
	});
};

Remove notices on window.* functions
Remove notices on window.* functions
