ページの読み込み直後に、オブジェクトにリンクされているすべての添付イベントの先頭に新しいイベントを配置するにはどうすればよいですか?
実際、私はいくつかのYUI関数を使用してその動作をアクティブ化するアコーディオンを持っていますが、YUIのメイン関数を変更せずに、AJAXルーチンを呼び出すために使用されるいくつかの新しい関数が必要です。現在、Event.getListenersを試していますが、返されたオブジェクトを処理する方法がわかりません。
よろしく
Event.getListeners から取得する応答は、Event.addListener に渡されるすべての引数です。Event.getListenersのドキュメントによると、返されます
the listener. Contains the following fields: type: (string) the type of event fn: (function) the callback supplied to addListener obj: (object) the custom object supplied to addListener adjust: (boolean|object) whether or not to adjust the default context scope: (boolean) the derived context based on the adjust parameter index: (int) its position in the Event util listener cache
したがって、そのオブジェクトを使用すると、おそらく Event.removeListener を使用してリスナーを削除し、Event.addListenerを使用して必要な順序ですべてを再度追加できます。オブジェクトのプロパティは Event.addListener の引数と 1:1 でマッピングされるため、何も失われません。