Commit Graph

16 Commits

Author SHA1 Message Date
Dave Pearson
847fd6e69e Add support for private watch methods
This change allows for private watch methods. By convention they start with
an underscore. If a reactive or var has a private watch method, it will be
used in preference to a public watch method.

With this change it becomes easier to have a private reactive/var whose
watcher is also private. For example:

    _counter = var(0)
    """This is a private counter, it won't appear in the docs."

    ...

    def _watch__counter(self) -> None:
        """Watch _counter, but don't appear in the docs either."
        ...

See #2382.
2023-05-01 10:01:50 +01:00
Will McGugan
52e522b2e8 test 2023-02-19 22:26:07 +00:00
Will McGugan
d18c794e69 call compute on demand 2023-02-19 22:24:28 +00:00
Darren Burns
9287f64a66 Add isort pre-commit hook, sort imports in src and test directories 2023-02-09 13:28:08 +00:00
Darren Burns
92ccf84496 Some updates to test_reactive 2023-01-16 11:06:13 +00:00
Darren Burns
fa1f33ff64 Remove a sleep that is no longer required in reactive test 2023-01-16 11:02:38 +00:00
Will McGugan
6063b0c9b2 remove comment [skip ci] 2023-01-13 21:17:19 +00:00
Will McGugan
6af2b61fc7 watching computed 2023-01-13 20:56:33 +00:00
Will McGugan
c3129c8331 fix inheritance 2023-01-13 17:22:52 +00:00
Will McGugan
8f0f0d8c12 refactor 2023-01-13 10:44:13 +00:00
Will McGugan
027635b978 merge 2023-01-12 17:45:36 +00:00
darrenburns
af8af1bee9 Ensure watcher isn't called on first_set when init is False and value doesn't change (#1367)
* Ensure watcher not called when value doesnt change, even on first set

* Update CHANGELOG.md
2022-12-20 11:17:11 +00:00
Darren Burns
2b8b7c15e6 Add extra test for validator called before dom ready, update changelog 2022-12-14 12:09:00 +00:00
Darren Burns
591b692720 Call validator on first set 2022-12-14 11:28:10 +00:00
darrenburns
e968ca0e50 Various tests for reactivity (#1223) 2022-11-18 19:40:30 +00:00
Will McGugan
dd5c0e612a make watchers instant 2022-11-09 12:06:14 +00:00