A Content Watcher is an object that contains some value. All time value changes a callback is triggered. Useful to link proccess and services via callback.
If you need some help or found bug you can open an issue.
There are some installation ways. You can choose the best way for you.
This way requires NodeJS installed:
$ npm install content-watcher
or using Yarn
$ yarn add content-watcher
Clone the repo into your project:
$ git clone https://github.com/enriquerene/content-watcher.git
Dowload the package and uncpack it into your project: Dowload ZIP
Here we cover how to properly use Content Watcher library. The ContentWatcher
instance requires a function as first argument and optionally can receive a second argument used as custom inital content. The default content is null
. Let's see some examples:
Set a callback and implement the class:
import ContentWatcher from 'content-watcher';
const updateCallback = (_v) => { console.log(_v) };
const contWat = new ContentWatcher(updateCallback);
console.log(contWat.content); // null
contWat.content = 'final content'; // console logs 'final content'
It accepts a second argument used as custom initial value:
import ContentWatcher from 'content-watcher';
const updateCallback = (_v) => { console.log(_v) };
const contWat = new ContentWatcher(updateCallback, 'initial content');
console.log(contWat.content); // 'initial content'
contWat.content = 'final content'; // console logs 'final content'
Some features what are expected for future versions:
- support for custom handler for different content types;
- official TypeScript version; Feel free to suggest features for futures versions, just open an issue.
If you have something good to share in this project, you are welcome. Just do a pull request with your code.
You can find more projects from ContentWatcher's author. Learn more about in (https://enriquerene.com.br)[https://enriquerene.com.br].