Skip to content

Instantly share code, notes, and snippets.

@jorroll
Created November 4, 2019 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorroll/00e05aebaf1f0039828e89fee1b95aeb to your computer and use it in GitHub Desktop.
Save jorroll/00e05aebaf1f0039828e89fee1b95aeb to your computer and use it in GitHub Desktop.
controlA.value; // => 'Hi'
const savedState = controlA.replayState();
controlA.setValue('Hello');
savedState.subscribe(controlA.source);
controlA.value; // => 'Hi'
// here we only sync the saved `disabled` state to `controlB`
savedState
.pipe(filter(({ type }) => type === 'disabled'))
.subscribe(controlB.source);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment