Skip to content

Instantly share code, notes, and snippets.

@deebloo
Last active August 30, 2020 00:41
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 deebloo/9fcccfe0663e840b2f9ea07cca1a6fc4 to your computer and use it in GitHub Desktop.
Save deebloo/9fcccfe0663e840b2f9ea07cca1a6fc4 to your computer and use it in GitHub Desktop.
import { component, State, JoistElement, property, get, PropChange } from '@joist/component';
@component({
tagName: 'app-root',
state: ''
})
class AppElement extends JoistElement {
@get(State)
private state!: State<string>;
@property()
public greeting = '';
@property()
public name = '';
onPropChanges(changes: PropChange[]) {
const keys = changes.map((change) => change.key);
if (keys.includes('greeting')) {
this.state.setValue(this.greeting);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment