1.0.1 • Published 1 year ago

@aarvinr/cron v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

cron

Bundle Size GitHub NPM NodeJS Deepsource

Minimal & lightweight reactive state library for JavaScript.

npm install @aarvinr/cron

Usage

cron(value)

Initializer function that sets a variable to reactive state.

import { cron } from "@aarvinr/cron";

const foo = cron("bar");

cron().get()

Returns the value of the reactive state.

foo.get(); // "bar"

cron().set()

Updates the value of reactive state and calls any listeners.

foo.set("baz");

cron().mut(method, ...args)

Calls the given method on the state with arguments and calls any listeners.

foo.mut("replace", "z", "r");
foo.get(); // "bar"

cron().mat(property)

Returns the given property of the state.

foo.mat("length"); // 3

cron().listen()

Runs callback whenever reactive state is updated.

const logger = foo.listen(() => {
  console.log("change:", foo.get());
});

foo.set("qux"); // "change: qux"

cron().batch(fn)

Runs fn() without calling listeners, and then calls listeners at end.

foo.batch(() => {
  foo.set("quux");
  foo.set("quuz");
}); // "change: quuz"

cron().deafen()

Stops all listeners from activating, or a specific listener.

foo.deafen(); // or logger.deafen()
foo.set("corge");
1.0.1

1 year ago

1.0.0

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago