Skip to content

Instantly share code, notes, and snippets.

@ksnabb
Last active December 18, 2018 11:28
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 ksnabb/1a591c112fbb4bf4b3187dca9b0bde9f to your computer and use it in GitHub Desktop.
Save ksnabb/1a591c112fbb4bf4b3187dca9b0bde9f to your computer and use it in GitHub Desktop.
const appEvents = pubSub();
const appState = state("", appEvents);
const input = document.querySelector('.app input');
const paragraph = document.querySelector('.app p');
input.addEventListener('input', (evt) => {
appState.setValue(evt.srcElement.value);
});
appEvents.subscribe((newValue) => {
paragraph.textContent = newValue;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment