A responsive system implemented in python with reference to the core mechanisms of S.js and vue reactivity.
Project description
py-signe
Introduction
A responsive system implemented in python with reference to the core mechanisms of S.js and vue reactivity.
Installation
pip install signe
使用
from signe import signal, effect, computed
num = signal(1)
@computed
def plus1():
return num.value + 1
@effect
def _():
print('plus1 is :',plus1.value)
# should print `plus1 is :2`
num.value=10
# should print `plus1 is :11`
signal
Creates a signal. Reads and writes via.value
.computed
Creates a computed expression. The argument is a function. When a signal (signal.value
) is used in the function to get a value, this calculation expression is automatically associated with the signal. When the value of the signal changes, the computed expression is automatically triggered to change.effect
is essentially the same ascomputed
. A change in the signal orcomputed
expression is automatically captured and triggered.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
signe-0.4.21.tar.gz
(13.8 kB
view hashes)
Built Distribution
signe-0.4.21-py3-none-any.whl
(20.2 kB
view hashes)