node-windows-mutex/README.md

27 строки
747 B
Markdown
Исходник Обычный вид История

2015-11-30 18:41:37 +03:00
# windows-mutex
2019-07-18 09:22:17 +03:00
[![Build Status](https://dev.azure.com/vscode/node-windows-mutex/_apis/build/status/microsoft.node-windows-mutex?branchName=master)](https://dev.azure.com/vscode/node-windows-mutex/_build/latest?definitionId=23&branchName=master)
2015-11-30 18:41:37 +03:00
Expose the Windows CreateMutex API to Node.JS.
## Installation
`windows-mutex` will only compile in Windows machines, so it is advisable
to use the `--save-optional` flag and wrap the
`require('windows-mutex')` call in a `try {} catch {}` block, in case your
code also runs on other platforms.
```
npm install --save-optional windows-mutex
```
## Usage
```javascript
import { Mutex } from 'windows-mutex';
2015-11-30 19:36:02 +03:00
var mutex = new Mutex('my-mutex');
2015-11-30 18:41:37 +03:00
console.log(mutex.isActive());
mutex.release();
```