
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@webgap/notifier
Advanced tools
This is the WebGAP Notifications Management module.
Handles abstraction for multiple notification mechanisms.
Handles most common object utilities with underscore.js.
Handles async implementation using async.
npm install @webgap/notifier --save
var notifier = require('@webgap/notifier');
// create Email Notification System Class
function EmailSystem() {}
// EmailSystem must implement a notify function, doesn't matter how you implement it
EmailSystem.prototype.notify = function (options, callback) {
console.log('\nEmail system send message: ' + JSON.stringify(options.notification));
return callback();
};
// register the system
notifier.register({name: 'EMAIL', instance: new EmailSystem(), defaultSystem: true});
...
// register as many systems as you want - notifier.register({name, instance, defaultSystem});
...
// create notification object
var options = {
notification: {
userId: 'id of the user to notify',
message: {
key: 'messages.error.text',
data: {errorCode: 111}
}
}
};
// notify using the default system
notifier.notify(options, function callback(err) {
err && console.log(err);
});
...
// notify using specific system(s)
var options = {
notification: {
userId: 'id of the user to notify',
message: {
key: 'messages.error.text',
data: {errorCode: 111}
}
},
notificationSystems: [notifier.systems.EMAIL, notifier.systems.OTHER]
};
notifier.notify(options, function callback(err) {
err && console.log(err);
});
...
Register method accepts the following options:
var options = {
name: 'name', // the name of the system
instance: new SomeClass(), // the instance with a notify method
defaultSystem: true // true or false, defaults to false
};
Notify method accepts the following options:
var options = {
notification: {}, // an object with the notification that the instance can handle
notificationSystems: [SystemA, SystemB] // an array with the system you want to notify with, if none is provided the default will be used. If none an error is returned
};
Apache License, Version 2.0
FAQs
Webgap abstraction notification module.
The npm package @webgap/notifier receives a total of 5 weekly downloads. As such, @webgap/notifier popularity was classified as not popular.
We found that @webgap/notifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.