onViewerAdded event is sent twice and onViewerClosed is never sent. To reproduce please run the following snippet, and then from the main menu open the Filters viewer (Add->Filters). After that close the Filters by clicking on the x button on the viewer’s toolbar.
let grid = grok.shell.addTableView(grok.data.demo.randomWalk(100, 100)).grid;
let nCallCount = 0;
grok.events.onViewerAdded.subscribe((args) => {
++nCallCount;
console.log("Call Count: " + nCallCount);
});
grok.events.onViewerClosed.subscribe((args) => {
console.log("Never gets called.");
});