As the name says, Reactivity is a lightweight javascript library to create simple reactive objects. Inspired in Redux and Vuex

Get started


npm install @darudlingilien/reactivity 


import Reactivity from '@darudlingilien/reactivity'


<script src="[email protected]/cdn/reactivity.min.js"></script>


First, Reactivity must be instantiated

const Reactive = new Reactivity();

The Reactivity constructor receives one paramater, an options parameter, which needs to receive all the data, middlewares and callbacks. For example...

new Reactivity({
    data: {
        msg: {
            type: String,
    beforeUpdating({ msg }) {
    updated({ msg }) {
    middlewares: {
        setters: {
            isEqualToHelloWorld(_, __, value) {
                return value === "Hello world";
        getters: //...

About options properties...

  1. data is required, each of its properties must have two sub-properties, type and value. This last one is optional, but type is required, it must be a build-in object constructor, like String, Boolean, Array...
  2. beforeUpdating/updated, could be functions or objects (with functions of course), the parameter is the current state of the data
  3. middlewares property has two sub-properties, setters and getters, each function defined in both properties receives the same parameters of a Proxy get and set traps and must return a boolean, otherwise it will fail


For set a property... = "Hello world";

For get a property...


All these actions will trigger all callbacks, either beforeUpdating/updated and middlewares

That's it, I hope you enjoy these package!