Closed GianlucaGuarini closed 11 years ago
why is the appendIndex wrong? it seems to be working pretty good
It was buggy together with public API returning wrong values https://github.com/GianlucaGuarini/fancyInput/blob/0b7a853e2895a795781acd42ae2d4c3e5c91bbe3/fancyInput.js#L117
I'm sorry I just don't understand your answer. what is this thing which you call Public API? and what is the bug? what steps would I need to take to reproduce it?
Having a public plugin API means that you can use the plugin events also outside of it for example:
var fancyInput = this.$el.find('textarea').fancyInput();
fancyInput.on('fi.addLetter',function(e,data){
console.log(data);
// a letter has been added
// data.index: letter index
// data.val: letter
});
fancyInput.on('fi.deleteLetter',function(e,data){
console.log(data);
// a letter has been deleted
// data.index: letter index
// data.val: letter
});
fancyInput.on('fi.linebreak',function(e){
// there's a new line break
});
fancyInput.on('fi.space',function(e,data){
// space clicked
});
With previous appendIndex code the data.index value was wrong but now everything works fine. Just download my version of your script and try yourself the public API and switching the appendIndex code to your old version to see the bug
but why would anyone need callbacks? there aren't any callbacks for such things since the dawn of computers, why now?
:smile: mine was just a proposal. I had to use your plugin on another project and I extended it to achieve my goal.. I think it could be useful but that's your business! :walking:
no..don't be insulted man, I'm sure your code was splendid! I just didn't have the time to actually test it, I wanted to get to it though
New API to get the plugin events from the outside