Document "gotcha" regarding `dispatch`.

The added remark might help people to save some time.
pull/3630/head
Philipp Schneider 6 years ago committed by Philipp Schneider
parent 5dda05213e
commit 79a848dbc2

@ -18,4 +18,5 @@ Components can also dispatch events. To do so, they must create an event dispatc
</script> </script>
``` ```
> `createEventDispatcher` must be called when the component is first instantiated — you can't do it later inside e.g. a `setTimeout` callback. This links `dispatch` to the component instance. > `createEventDispatcher` must be called when the component is first instantiated — you can't do it later inside e.g. a `setTimeout` callback. This links `dispatch` to the component instance.
> `dispatch` can only be called once the component has been mounted. It is therefore not possible to call `dispatch` from the `beforeUpdate` lifecycle.

Loading…
Cancel
Save