Skip to content

Instantly share code, notes, and snippets.

@zbarbuto
Created December 14, 2017 00:54
Show Gist options
  • Save zbarbuto/a261ac409f2c5f9a485723f553b97ac0 to your computer and use it in GitHub Desktop.
Save zbarbuto/a261ac409f2c5f9a485723f553b97ac0 to your computer and use it in GitHub Desktop.
import { ReduxDevtoolsExtensionConnection } from '@ngrx/store-devtools/src/extension';
export class RemoteDevToolsConnectionProxy
implements ReduxDevtoolsExtensionConnection {
constructor(public remotedev: any, public instanceId: string) {}
subscribe(listener: (change: any) => void): any {
const listenerWrapper = (change: any) => {
listener(change);
};
this.remotedev.subscribe(listenerWrapper);
// Hack fix for commit/time-travelling etc. if the devtools are already open
setTimeout(() => listenerWrapper({ type: 'START' }));
}
unsubscribe(): any {
// HACK fix bug in @ngrx/store-devtools that calls this instead of returning
// a lambda that calls it when their Observable wrapper is unsubscribed.
return () => this.remotedev.unsubscribe(this.instanceId);
}
send(action: any, state: any): any {
// Never called
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment