Factory & Instance


Proppy factories are functions that return you the Proppy instance.

The factories optionally accept a common providers object which can be used by the instances as they see fit.

In the example below, P is a factory:

const P = function (providers = {}) {
  return instance;

We will learn about the API of the instance below:


Proppy instances allow you to access the props both synchronously, as well as asynchronously via subscription:

const p = P();

// current props (synchronous)

// subscription (asynchronous)
// will emit as many times the props get updated
const unsubscribe = p.subscribe(props => console.log(props));

// destroy
// all listeners are unsubscribed and internal state is cleared

The library itself is unopinionated how you implement your factories and instances yourself. But it comes with a handy create function that helps you to create your own instances quickly.

It's best if you read the quick start guide next.