Last active
November 4, 2018 04:34
-
-
Save redgeoff/f51de757ce85e12e3d5794b11ec45e17 to your computer and use it in GitHub Desktop.
MSON Talk: EventEmitters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instantiate with default prop | |
const component = new MyComponent({ firstName: 'Robert' }); | |
// Listener that is run when lastName changes | |
component.on('lastName', value => { /* new lastName */ }); | |
// Set props | |
component.set({ firstName: 'Bob', lastName: 'Marley' }); | |
component.get('firstName'); // Bob | |
component.get(['firstName', 'lastName']); // { firstName: 'Bob', lastName: 'Marley' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment