How do I invoke a private method from a public one and vice versa if I follow the plugin authoring guide?
I usually declare the private methods within the init
method like:
var methods = {
init: function(options) {
var settings = $.extend({
}, options);
return this.each(function() {
var $this = $(this);
var data = $this.data('griffin-editor');
this.trimSpaceInSelection = function () {
//how do I call a public method here?
//to get the this context correct.
}
if (typeof data !== 'undefined') {
return this;
}
//the rest of the code.
It might be the incorrect thing to do?