YUI3 ライブラリを利用して非同期イベントを実装しようとしています。そのため、アプリケーションは、ロード イベントや準備完了イベントのように、サブスクリプションが遅れていても渡されたイベントについて通知されていました。
ここに私がこれまでに持っているものがありますが、運がありません。
YUI().use('event', 'event-custom', function(Y){
function onCustomEvent () {
Y.Global.on('custom:event', function(){
alert('custom fired');
});
}
window.setTimeout(onCustomEvent, 2000);
});
YUI().use('event', 'event-custom', function(Y){
Y.publish('custom:event', {
emitFacade: true,
broadcast: 2,
fireOnce: true,
async: true
});
function fireCustomEvent () {
Y.Global.fire('custom:event');
}
window.setTimeout(fireCustomEvent, 1000);
});
誰かがこのコードの何が問題なのかヒントを与えることができれば? ありがとうございました。
更新:
少し調査した結果、非同期イベントは 1 つのuse()
インスタンス内で、Global
ブロードキャストを使用していないときに正常に機能することがわかりました。それはバグか制限のどちらかです。まだ発見中