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
ember install ember-mutex
Usage
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
ember try:testall