xx: Object Locking for JavaScript
It's what you need when you need it, but you have to wait in line to get it.
xx simplifies the synchronization of data objects between concurrent tasks.
Installation
- Node.JS:
npm install xx
- Browsers: Add
lib/xx.js
to your HTML page.
Intro
Here's a brief example that shows how to use xx
:
var xx = ; // import xx var config = {}; // Have some data to guard configxx = ; // Create a lock object // Acquire lock on the object with an async callback:config;
Usage with Async Libraries
Here's a brief example that shows how it can be used with an async library (such as ff
):
var xx = ; // import xxvar ff = ; // Use ff for a demo var config = fileA: "A.txt" fileB: "B.txt"; // Have some data to guard configxx = ; // Create a lock object var f = ;