message: fix(devtools): implement shutdown event to prevent memory leak when reopening devtools (rangle/angular-devtools#53)
diff: @@ -20,6 +20,8 @@ import {
  } from './angular-check';
  export const subscribeToClientEvents = (messageBus: MessageBus<Events>): void => {
  + messageBus.on('shutdown', shutdownCallback(messageBus));
  +
  messageBus.on('getLatestComponentExplorerView', getLatestComponentExplorerViewCallback(messageBus));
  messageBus.on('queryNgAvailability', checkForAngularCallback(messageBus));
  @@ -38,6 +40,10 @@ export const subscribeToClientEvents = (messageBus: MessageBus<Events>): void =>
  initChangeDetection(messageBus);
  };
  +const shutdownCallback = (messageBus: MessageBus<Events>) => () => {
  + messageBus.destroy();
  +};
  +
  const initChangeDetection = (messageBus: MessageBus<Events>) => {
  if (appIsAngularInDevMode() && appIsSupportedAngularVersion()) {
  onChangeDetection(() => messageBus.emit('componentTreeDirty'));
  