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

How to detect re-renders? #56

Closed
ConsoleTVs opened this issue Nov 30, 2019 · 2 comments
Assignees
Labels

Comments

@ConsoleTVs
Copy link

@ConsoleTVs ConsoleTVs commented Nov 30, 2019

I am wondering how does the project detect re-renders, in the counter example, you increment the prop of the class directly. How do you detect it's time to render again because of that side effect?

PD; Very nice project, no dependencies and great ideas. Looking forward more!

@jcormont jcormont added the question label Dec 4, 2019
@jcormont jcormont self-assigned this Dec 4, 2019
@jcormont

This comment has been minimized.

Copy link
Member

@jcormont jcormont commented Dec 4, 2019

Thanks! Development has been a little slow recently because of work, but great to hear positive feedback.

Typescene keeps track of bindings (in the example there is a binding in the view), and then, when the target component is constructed, the bound properties are defined with a getter and setter. These update 'bound' binding(s) immediately - in this case a property of the view component.

The view property is observed in the same way, and any change updates the DOM.

@jcormont jcormont closed this Dec 4, 2019
@ConsoleTVs

This comment has been minimized.

Copy link
Author

@ConsoleTVs ConsoleTVs commented Dec 4, 2019

So you use a proxy to modify the class and set a global getter to it? This is cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.