Skip to content

Commit

Permalink
the name
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyraspopov committed Oct 13, 2023
1 parent 84ed05d commit ca4fc93
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# Reactivity
# dataflow

A tiny library for integrating reactive signals anywhere. Memory-efficient, least CPU overhead.
A tiny library for integrating reactive signals anywhere.

- Zero dependencies and tiny bundle (around 700B min+gzip)
- Predictable memory management
- Smallest CPU overhead
- TypeScript typings included

```js
import { ObservableScope } from "dataflow";

/* Create isolated scope that has its own lifecycle */
let os = ObservableScope();

/* Use signals to define values and relations between them */
let counter = os.signal(0);
let doubled = os.derive(() => counter() * 2);

/* Use watchers to track value changes and perform side effects */
let output = document.getElementById("output");
os.watch(() => {
output.innerText = doubled();
});

/* Trigger value updates that will ensure all relations updated as well */
let trigger = document.getElementById("trigger");
trigger.addEventListener("click", () => {
counter((value) => value + 1);
});
```
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion reactivity.test.js → dataflow.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, mock } from "node:test";
import { equal, deepEqual } from "node:assert/strict";
import { ObservableScope } from "./reactivity.js";
import { ObservableScope } from "./dataflow.js";

/* The most basic use case is to be able to hold a value in a Signal. */
test("signal", () => {
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"name": "reactivity",
"type": "module"
"name": "dataflow",
"version": "0.0.0",
"type": "module",
"files": [
"dataflow.d.ts",
"dataflow.js"
]
}

0 comments on commit ca4fc93

Please sign in to comment.