jquery.AreYouSure icon indicating copy to clipboard operation
jquery.AreYouSure copied to clipboard

Include concrete methods as well as triggers

Open jonegerton opened this issue 11 years ago • 2 comments

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.

jonegerton avatar Jan 28 '14 13:01 jonegerton

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.

codedance avatar Jan 29 '14 23:01 codedance

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.

codedance avatar Feb 16 '14 06:02 codedance