Skip to content

Instantly share code, notes, and snippets.

@tdpauw
Created May 13, 2014 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdpauw/1c82c7788843b700b2cb to your computer and use it in GitHub Desktop.
Save tdpauw/1c82c7788843b700b2cb to your computer and use it in GitHub Desktop.
Countdown latch for AngularJS
(function() {
'use strict';
angular.module('countDownLatch', [])
.factory('CountDownLatch', function() {
var service = {
createInstance: function(countDown, onComplete) {
return {
countDown: function() {
--countDown;
if (countDown <= 0) {
onComplete();
}
}
};
}
};
return service;
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment