z-lock

This CommonJS module can create a simple "lock" that can be checked, locked/unlocked.

Usage no npm install needed!

<script type="module">
  import zLock from 'https://cdn.skypack.dev/z-lock';
</script>

README

z-lock

Build Status npm version

Since it's a CommonJS module, it must be used alongside with Browserify, or something similar, like WebPacker.

Example, explanation

var lock = require('z-lock');
var a_lock = new lock();

a_lock.isLocked(); // returns false

// Let the examples tell the story
a_lock.lock();
a_lock.isLocked(); // returns true

a_lock.unLock();
a_lock.isLocked(); // returns false

License

MIT