Marionette.EventAggregator 및 Marionette.EventBinder의 문서는 코드가 동일합니다. 차이가 있다고 생각해. 그게 뭐야? 언제 그들 각각을 사용합니까?EventAggregator와 Backbone Marionette의 EventBinder의 차이점은 무엇입니까?
4
A
답변
5
주요 차이점은 의도적이었습니다. EventAggregator의 의도는이 기사에서 설명 : Backbone.js : repopulate or recreate the view?
:http://martinfowler.com/eaaDev/EventAggregator.html
http://codebetter.com/jeremymiller/2009/07/22/braindump-on-the-event-aggregator-pattern/
EventBinder의 목적으로 먼저 여기 조니 Oshika 설명 이벤트 바인딩의 종속성을 관리하는 것이 었습니다
...
이제 Marionette 및 Backbone v0.9.9로 이동하면서 Backbone.Events에 listenTo
및 stopListening
메서드가 포함되어 EventBinder가 이제 폐기되었습니다. EventAggregator
은 Backbone.Events에서 다루지 않는 것을 대신합니다. 이것은 Marionette v1.0-rc3 이상을위한 것입니다. Marionette v1.0-rc2 이전 버전을 계속 사용 중이라면 여전히 EventBinder가 필요합니다.
나는 이벤트의 추가가 0.9.9에 있다는 것을 알지 못해서 좋은 소식을 +1했습니다. –