Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Latest commit

 

History

History
70 lines (54 loc) · 2.01 KB

events.md

File metadata and controls

70 lines (54 loc) · 2.01 KB

viewEvents

The viewEvents object is a global d3-dispatch instance for registering events triggered by views, components and directives.

component-created

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");
});

component-mount

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");
});

component-children-mounted

Fired when all children components have been mounted

viewEvent.on('component-children-mounted.test', vm => {
    vm.logInfo("Hi, Children are fully mounted");
});

component-mounted

Fired when a component has been fully mounted

viewEvent.on('component-mounted.test', vm => {
    vm.logInfo("Hi, I'm fully mounted");
});

component-error

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
});

directive-refresh

viewEvent.on('directive-refresh.test', (dir, model, value) => {
    dir.logInfo("Hi, I've just refreshed");
});