Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 342 Bytes

README.md

File metadata and controls

21 lines (13 loc) · 342 Bytes

Util - watchTarget

get notified when the watch target value changes

Usage

const a = watchTarget('a');

const cleanup = a.watch((a) => console.log(`a is now '${a}'`));
// console output: a is now 'a'

a.get(); // 'a'

a.set('A');
// console output: a is now 'A'

cleanup();

a.set('X'); // (no more console output)