Where to set global configurations for the client


#1

Hi,

I have a question to where i should place some code to set some global client configurations for a jquery plugin. Im using this awesome plugin that I really like: https://atmospherejs.com/jeremy/noty, which provides clean and awesome way to give feedback messages to an user just by using

noty({text: 'noty - a jquery notification library!'});

The plugin comes with a lot of configurations that you can set. Some of the default ones i dont like, like the message showing up in top center, i prefer top right.

And I usually i can set some global defaults:

$.noty.defaults = { layout: 'topRight', type: 'alert' };

So that i dont have to worry about it any more and just call noty({text: 'noty - a jquery notification library!'});

My big question, is where do can i set that $.noty.defaults so that is globally available in all the client templates that i use?
I dont want to put something in each template saying:

Template.something_template.rendered=function(){ bla bla bla}

in each template…

Thanks


#2

You could attach it to the <body>:

Template.body.onRendered(function() {
  this.$.noty.defaults = {
    layout: 'topRight',
    type: 'alert'
  };
});

#3

does not work… weird