私がやろうとしていることの簡略版は次のとおりです。
var indication = $('#some-div');
indication.bind('custom-event', function() { ... }
// ... later on!
function OtherThing() {
$(this).trigger('custom-event');
}
二人がお互いをはっきりと知らなくてもindication.bind('custom-event')
、トリガーを受け取りたいのですが。function OtherThing
これは可能ですか?これまでの私の唯一の解決策は、リスナーとイベントの両方をボディにバインドすることです...これはずさんなようです-より良い方法はありますか?