jquery.AreYouSure
jquery.AreYouSure copied to clipboard
Include concrete methods as well as triggers
Would be nice to have concrete methods to call, as well as the triggers for actions. For example instead of
$("form").trigger("rescan.areYouSure");
we'd have something along the lines of:
$("form").areYouSure.rescan();
This would give IDEs with intellisense something to go off and help avoid bugs when coding. It would also improve compatibility with things like TypeScript.
Incidentally, I added areYouSure to DefinitelyTyped here.
Agree. Options are good. I looked at this when the rescan event was added and there seemed like there where n different ways of defining these in a jQuery plugin with different pros and cons... I ended up putting it in the "think about it later" bucket :-)
Do you have any favourite jQuery plugins that do this well?
Thanks for the DefinitelyTyped inclusion.
I've taken a further look at this. It looks like the most popular "method" (no pun intended :-) is to pass strings into the constructor. e.g.
$('#myform').areYouSure('rescan');
$('#myform').areYouSure('checkform');
I would welcome some further discussion/conformation before making the change.