Open jorenmartijn opened 8 years ago
Hi, @jorenmartijn! I think maybe extracting the usage to your own function which returns the notify object with default options is the "best practise" way to solve this.
Thanks for the quick response! Using your suggestion I wrote the following, which seems to work perfectly :)
function notice(options){
var params = options;
params['icon'] = path.join(__dirname, "favicon.png");
return notify(params);
}
Regards, Joren
Good! Note, though, this mutates the object that you passed in. This means that if you send in the same object across several functions, they have the same changes. You can use something like lodash.assign
, some extend
implementation or just Object.assign
if you are running Node 6 to avoid mutation. For instance:
function notice(options){
return notify(Object.assign({}, options, {
icon: path.join(__dirname, "favicon.png")
});
}
Hi,
I'd like to be able to set my notification icon globally so I don't have to pass it through the .pipe(notify()) command in my gulp file. Is there anyway I can do that? I found the defaults object in the reporter.js file, but can't figure out how to manipulate that from the gulp file.
Regards, Joren