Skip to content

Instantly share code, notes, and snippets.

@Johannestegner
Created June 30, 2015 18:30
Show Gist options
  • Save Johannestegner/43be3e481bae4299ce9c to your computer and use it in GitHub Desktop.
Save Johannestegner/43be3e481bae4299ce9c to your computer and use it in GitHub Desktop.
Continual Notifiers
/**
* @constructor
*/
var ConsoleNotifier = function ConsoleNotifier() { };
/**
* Fetches the name of the notifier.
* @returns {string} Notifier name.
*/
ConsoleNotifier.prototype.getName = function () { return "ConsoleNotifier"; };
/**
* Fetches the version of the notifier - 'x.x.x.x'.
* @returns {string} Notifier version.
*/
ConsoleNotifier.prototype.getVersion = function () { return "1.0.0.0" };
/**
* Notifies with a error.
* @param {string} str Error string.
* @param {function} callback On done callback.
*/
ConsoleNotifier.prototype.sendError = function sendError(str, callback) {
// This notifier is quite basic, we just print the message to the console!
console.error(str);
// Then fire the callback!
callback();
};
/**
* Notifies with a success message.
* @param {string} str Message string.
* @param {number} time Time in seconds the execution of test took.
* @param {function} callback On done callback.
*/
ConsoleNotifier.prototype.sendSuccess = function sendSuccess(str, time, callback) {
// This notifier is quite basic, we just print the message to the console!
console.log("Job done. Message: " + str + " - the job took: " + time + " ms to complete");
// Then fire the callback!
callback();
};
module.exports = new ConsoleNotifier();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment