Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget class property watch decorator #75

Merged
merged 4 commits into from
Aug 22, 2018
Merged

Conversation

agubler
Copy link
Member

@agubler agubler commented Aug 21, 2018

Type: feature

The following has been addressed in the PR:

Description:

Adds a watch decorator that will call invalidate when the property is set automatically.

Resolves #74

@agubler agubler changed the title Add watch decorator Widget class property watch decorator Aug 21, 2018
@agubler agubler added enhancement New feature or request next Issue/Pull Request for the next major version labels Aug 21, 2018
Copy link
Contributor

@mwistrand mwistrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but otherwise looks good.


It is common for widgets to maintain internal state, that directly affects the results of the render output or passed as properties to child widgets. The most common pattern is that an action (often user initiated via an event) occurs which updates the internal state leaving the user to manually call `this.invalidate()` to trigger a re-render.

For class properties that always need to trigger a re-render when it's updated, a property decorator, `@watch` can be used, which implicitly calls `this.invalidate` each time the property is set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"trigger a re-render when it's updated": "it's" => "they're"

@agubler agubler merged commit 05e991a into dojo:master Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next Issue/Pull Request for the next major version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants