The viewEvents
object is a global d3-dispatch instance
for registering events triggered by views, components and directives.
- component-created
- component-mount
- component-children-mounted
- component-mounted
- component-error
- directive-refresh
Fired when a component has been created. In this state the component is unmounted and the model
attribute is a vanilla object.
viewEvent.on('component-created', vm => {
vm.logInfo("Hi, I've been created");
});
Fired when a component is about to be mounted. In this state the component is unmounted and has the same properties as in the component-created
event. The only difference is the availability of the ownerDocument
attribute.
viewEvent.on('component-mount.test', (vm, origEl, data) => {
vm.logInfo("Hi, I'm about to be mounted");
});
Fired when all children components have been mounted
viewEvent.on('component-children-mounted.test', vm => {
vm.logInfo("Hi, Children are fully mounted");
});
Fired when a component has been fully mounted
viewEvent.on('component-mounted.test', vm => {
vm.logInfo("Hi, I'm fully mounted");
});
Fired when the component failed to mount
viewEvent.on('component-error.test', (vm, origEl, exc) {
// an error has occurred and it has been logged already
});
viewEvent.on('directive-refresh.test', (dir, model, value) => {
dir.logInfo("Hi, I've just refreshed");
});