Skip to content

a simple small library for adding reactivity to your apps!

License

Notifications You must be signed in to change notification settings

oarabilekoore/reactive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

signalLib

MIT Licensed Version Badge

signalLib is a small, simple library for intergrating reactivity concepts like signals and observables.

Installation

pip install signallib

Getting Started

Making Values Reactive

from signallib import signal

name = signal('oarabile')

# this method takes in a function and
# when the value is changed, it passes
# the new variable into that function.
name.subscribe(lambda x: print(x))

# this is both our setter and getter
name.value = 'averylongnamecausewhynot'

# the "name" is printed onto the console

Observing Changes To A Dict

from signallib import observe

user = { "name": "oarabile", "age": 19 }

user = observe(user)

user.observer(lambda prop, value: print('The Prop Is ${prop}, and Value Of ${value}'))

user.name = 'john'

# we can even add custom properties
user.location = 'botswana'

# this is printed to the console 👇
# The Prop Is name, and Value Of john

Contributing

We welcome contributions to rosana.ds! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make changes and commit (git commit -am 'Add new feature').
  4. Push to your fork (git push origin feature-branch).
  5. Open a Pull Request.

Feel free to suggest new features and improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

a simple small library for adding reactivity to your apps!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages