# ember-mutex

> A simple mutex implementation for Ember.

Latest version **0.0.0** (published 2016-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-mutex
pnpm add ember-mutex
yarn add ember-mutex
bun add ember-mutex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2016-11-23 |
| First published | 2016-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Dmitri Akatov |
| Maintainers | akatov |
| Keywords | ember-addon, ember-mutex, mutex |

## Links

- npm: https://www.npmjs.com/package/ember-mutex
- Repository: https://github.com/akatov/ember-mutex
- Homepage: https://github.com/akatov/ember-mutex#readme
- Issues: https://github.com/akatov/ember-mutex/issues
- npm.io page: https://npm.io/package/ember-mutex

## Dependencies (1)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^5.1.5

## Recent versions

- 0.0.0 (latest) — 2016-11-23

## README

# Ember-mutex

[![Build Status](https://travis-ci.org/akatov/ember-mutex.svg)](https://travis-ci.org/akatov/ember-mutex)
[![Code Climate](https://codeclimate.com/github/akatov/ember-mutex/badges/gpa.svg)](https://codeclimate.com/github/akatov/ember-mutex)
[![Test Coverage](https://codeclimate.com/github/akatov/ember-mutex/badges/coverage.svg)](https://codeclimate.com/github/akatov/ember-mutex/coverage)
[![Issue Count](https://codeclimate.com/github/akatov/ember-mutex/badges/issue_count.svg)](https://codeclimate.com/github/akatov/ember-mutex)

A simple mutex implementation using Ember (RSVP) Promises.
This is pretty much a copy of https://github.com/plenluno/promise-mutex adjusted for Ember.

## Installation

```bash
ember install ember-mutex
```

## Usage

```js
import Mutex from 'ember-mutex';
let mutex = Mutex.create();

let sayHelloSynced = function() {
  mutex.lock(function() {
    return new Ember.RSVP.Promise(function(resolve) {
      console.log('hello');
      Ember.run.later(null, resolve, 1000);
    });
  });
};
sayHelloSynced(); // should print 'hello' immediately
sayHelloSynced(); // will print 'hello' after 1000ms
```

## Running Tests

```bash
ember try:testall
```

---
_Source: https://npm.io/package/ember-mutex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
