Pretty good way to prep for the Vue 2.0 release. Thanks for the implementation example.
I was playing around with the implementation for my app and I noticed one thing that suppose
The <listens-for-event> component is instantiated through v-if condition which evaluates to false when the event is emitted i.e. the <listens-for-event> component is not yet rendered (or is not present in the current scope) then subsequently when v-if evaluates to true and the component is rendered or instantiated (post the event being emitted), it is not able to catch the event through the listener.
//08:40:10
<fires-event> /* emits an event */ </fires-event>
<listens-for-event v-if="someCondition"></listens-for-event> //here someCondition = false, so it is not rendered
//08:40:15
someCondition=true;
<listens-for-event v-if="someCondition"></listens-for-event> gets rendered, but is not able to catch the event and handle response
//But if scenario is as under:
//08:40:10
<listens-for-event v-if="someCondition"></listens-for-event> //someDondition=true; so it gets rendered and is able to catch the event and respond
<fires-event> /* emits an event */ </fires-event>
Is this how it is supposed to work - that any component needs to be within the current scope (has been rendered) to catch any event which is emitted, if it is not rendered when an event is emitted later on when it gets rendered, it will not be able to catch and respond to any event fired/emitted before the component was rendered? Or am I doing something wrong?