Hello,
I want to try to understand the use of these constructs because I don't.
If I see this in a plugin
function configuration(user_settings) {
//Override the default settings with the user settings
defaults = {
time_in_seconds: 3600,
time_format: 'ss',
tick: function(timer, time_in_seconds, formatted_time) {},
buzzer: function(timer) {},
autostart: true
};
return $.extend(defaults, user_settings);
}
The tick is called within the plugin and setting new values but when I comment those lines out, everything still works.
What is the general idea behind it. I looked at the github page, but there is no explanation
EDIT
If the plugin iterates, it is setting the parameters of tick
settings.tick(timer, current_time, formatted_time);
How can I set a user_setting for tick, that still makes use off those parameters?
In other words, getting something in between those execution {} brackets.
EDIT I did some more testing and apparently it is possible to pass any number of parameters at any time. Just pas something like
$("#countdown_update").createTimer({time_in_seconds: ( delay? delay/1000 : minTimeBetweenUpdates/1000 ),
tick:function(one,two){$('#test').html('test '+one+two);}});
It will give you the timer object and the time_in_seconds in the output
thanks, Richard