example 4 - abudaan/vega-multi-view GitHub Wiki

import { addViews, remove } from 'vega-multi-view';

addViews({
    specs: {
        spec1: '../specs/spec1.yaml'
    }
})
.then(result => {
    console.log(result) // { spec1: view...}
    setTimeout(() => {
        const result2 = removeViews('spec1');
        console.log(result2) // {}
    }, 3000);
});

This example shows how you can remove a view. The removeViews function takes a single id, a list of ids or an array of ids and returns the updated key-value store object. In this example the store is an empty object after we have removed the only view with id spec. Note that unlike addViews the removeViews function does not return a promise.