Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
A tiny transparent function reactive library built for didactic purposes.
Originally meant to illustrate the points about transparent reactive programming during ProgrammersWeek 2021 event, so it's definitely not production ready.
The library exports 3 functions: observable
, effect
and computed
, the building blocks of any reactive library.
It does not offer wrappers around various used land frameworks since their implementation it's pretty simple and can be easily achieved using used land code.
Wraps any data, either primitive or objects and turns it into an observable entity.
Wrapping a primitive returns an object with a single property: value
.
Executes a function a tracks the observables used inside it. It re-runs the fn
function whenever any read observable property changes.
const o = observable({firstName: 'a', lastName: 'b'});
const effectFn = () => { console.log(`${o.firstName}-${o.lastName}`); };
const unsubscribe = effect(effectFn);
unsubscribe();
Returns a function that, when called, it removes the watches on any tracked observable properties.
A variation of the effect
function that is meant to compute derived values. Just as effect
it auto-magically tracks any read observables inside the fn
function but it also memoizes the return value of fn()
until any tracked observables change.
As such fn
is deemed to be a PURE function and return a value.
const o = observable({firstName: 'a', lastName: 'b'});
const computedFn = () => `${o.firstName}-${o.lastName}`;
const fullName = computed(computedFn);
console.log(fullName.value);
It returns an observable
instance wrapping whatever value fn()
returned.
FAQs
A tiny state management library built for ProgrammersWeek 2021
The npm package tiny-frp receives a total of 0 weekly downloads. As such, tiny-frp popularity was classified as not popular.
We found that tiny-frp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.